home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / createPrefWndUI.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  76.7 KB  |  3,058 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Jan 2000
  22. //
  23. //  Description:
  24. //  
  25. //    These procedures create the UI for the Preferences window.
  26. //    - Each procedure should only create the UI.
  27. //  - Create any optvars in "createPreferenceOptvars.mel"
  28. //    - Set the state of the UI in the update procedures
  29. //      found in updatePrefWndUI.mel
  30. //    - Commands attached to controls should not change the
  31. //      optionVar status as this will affect the canel/reset.
  32. //
  33. //    Note: If adding preferences, make sure to read
  34. //    http://w3.tor.aw.sgi.com/maya/TechDoc/CodingGuides/addingPreferences.html
  35. //
  36.  
  37. //----------------------------------------------------------------
  38. //
  39. //    Begin section of callback procedures
  40. //
  41. //----------------------------------------------------------------
  42.  
  43. global proc prefApplyWorkingMode() 
  44. {
  45.     global string $gPreferenceWindow;
  46.     setParent $gPreferenceWindow;
  47.  
  48.     string $newMode = `optionMenuGrp -q -v modeOpts`;
  49.     switch( $newMode ) {
  50.         case "Animation":    workingMode Animation; break;
  51.         case "Modeling":    workingMode Modeling; break;
  52.         case "Rendering":    workingMode Rendering; break;
  53.         case "Dynamics":    workingMode Dynamics; break;
  54.         default:            workingMode Animation; break;
  55.     }
  56. }
  57.  
  58. global proc setUpAxis(string $axis)
  59. {
  60.     switch ($axis) {
  61.     case "y":
  62.         if (`upAxis -q -axis` != "y") {
  63.             upAxis -axis y -rv;
  64.         }
  65.         break;
  66.     case "z":
  67.         if (`upAxis -q -axis` != "z") {
  68.             upAxis -axis z -rv;
  69.         }
  70.         break;
  71.     }
  72. }
  73.  
  74. global proc toggleMenuBarsInPanels( int $state ) 
  75. {
  76.     global int $gUseMenusInPanels;
  77.     $gUseMenusInPanels = $state;
  78.  
  79.     // Walk through all the panels and switch them
  80.     //
  81.     string $panels[] = `getPanel -allPanels`;
  82.     string $panel;
  83.     for ( $panel in $panels ) {
  84.         panel -e -mbv $state $panel;
  85.     }
  86. }
  87.  
  88. global proc setPrefChannelsLayersVisible( int $state )
  89. //
  90. //    Description:
  91. //        This procedure is called when the Channel Box / Layer Editor
  92. //        visibility check box is toggled by the user.
  93. //
  94. //        Set the appropriate visibility.
  95. //        Doing so may hide other components because only one is allowed
  96. //        to be visible at the same time.  It is therefore necessary to 
  97. //        update the state of the other component's visibility check boxes.
  98. //
  99. //    Arguments:
  100. //        state - The current value of visibility check box.
  101. //
  102. {
  103.     //    Toggle the visibility of the Channel Box / Layer Editor.
  104.     //
  105.     setChannelsLayersVisible ($state);
  106.  
  107.     //    Update the state of the other visibility check boxes.
  108.     //
  109.     checkBoxGrp -edit
  110.         -value1 `isUIComponentVisible("Attribute Editor")`
  111.         attributeEditorCheckBox;
  112.  
  113.     checkBoxGrp -edit
  114.         -value1 `isUIComponentVisible("Tool Settings")`
  115.         toolSettingsCheckBox;
  116. }
  117.  
  118. global proc setPrefAttrEditorVisible( int $state )
  119. //
  120. //    Description:
  121. //        This procedure is called when the Attribute Editor visibility check 
  122. //        box is toggled by the user.
  123. //
  124. //        Set the appropriate visibility for the Attribute Editor.
  125. //        Doing so may hide other components because only one is allowed
  126. //        to be visible at the same time.  It is therefore necessary to 
  127. //        update the state of the other component's visibility check boxes.
  128. //
  129. //    Arguments:
  130. //        state - The current value of the Attribute Editor visibility
  131. //                check box.
  132. //
  133. {
  134.     //    Toggle the visibility of the Attribute Editor.
  135.     //
  136.     setAttributeEditorVisible ($state);
  137.  
  138.     //    Update the state of the other visibility check boxes.
  139.     //
  140.     checkBoxGrp -edit
  141.         -value1 `isUIComponentVisible("Channel Box / Layer Editor")`
  142.         channelsLayersCheckBox;
  143.  
  144.     checkBoxGrp -edit
  145.         -value1 `isUIComponentVisible("Tool Settings")`
  146.         toolSettingsCheckBox;
  147. }
  148.  
  149. global proc setPrefToolSettingsVisible( int $state )
  150. //
  151. //    Description:
  152. //        This procedure is called when the Tool Settings visibility check 
  153. //        box is toggled by the user.
  154. //
  155. //        Set the appropriate visibility for the Tool Settings.
  156. //        Doing so may hide other components because only one is allowed
  157. //        to be visible at the same time.  It is therefore necessary to 
  158. //        update the state of the other component's visibility check boxes.
  159. //
  160. //    Arguments:
  161. //        state - The current value of the Tool Settings visibility
  162. //                check box.
  163. //
  164. {
  165.     //    Toggle the visibility of the Tool Settings.
  166.     //
  167.     setToolSettingsVisible ($state);
  168.  
  169.     //    Update the state of the other visibility check boxes.
  170.     //
  171.     checkBoxGrp -edit
  172.         -value1 `isUIComponentVisible("Channel Box / Layer Editor")`
  173.         channelsLayersCheckBox;
  174.  
  175.     checkBoxGrp -edit
  176.         -value1 `isUIComponentVisible("Attribute Editor")`
  177.         attributeEditorCheckBox;
  178. }
  179.  
  180. global proc prefExprEdTextEditor(int $isStartup)
  181. {
  182.     int $whichEditor = `optionMenuGrp -q -sl textEdOpts`;
  183.     optionVar -iv "EEexprEdTextEditor" $whichEditor;
  184.  
  185.     if (!$isStartup && $whichEditor == 6)
  186.     {
  187.         string $theMessage = "Set your own editor with preferred flags by setting the\nenvironment variable \"WINEDITOR\", if it is not already set.\nYou can set it at the command window or through the SGI\nDesktop menu --DeskTop/Desktop/Default Editor.\nWarning: the editor must be set to run in the foreground.\n";
  188.         string $winEditor = getenv("WINEDITOR");
  189.         if (size($winEditor) == 0)
  190.         {
  191.             $theMessage = $theMessage + "Currently \"WINEDITOR\" is not set.";
  192.         }
  193.         else
  194.         {
  195.             $theMessage = 
  196.                 $theMessage + "\"WINEDITOR\" is now set to \"" + $winEditor + "\".";
  197.         }
  198.         confirmDialog -t "Information"
  199.             -ma "left"
  200.             -m  $theMessage
  201.             -b "Close"
  202.             -cb "Close"
  203.             -parent uiPreferenceWindow;
  204.     }
  205. }
  206.  
  207. global proc prefWndUnitsChanged(string $whichUnits) 
  208. {
  209.     global string $gPreferenceWindow;
  210.     setParent $gPreferenceWindow;
  211.  
  212.     if ("linear" == $whichUnits) {
  213.         changeLinearUnit( `optionMenuGrp -q -v linearOpts` );
  214.     } else if ("angular" == $whichUnits) {
  215.         if (`optionMenuGrp -q -sl angularOpts` == 1) {
  216.             currentUnit -a degree;
  217.         } else {
  218.             currentUnit -a radian;
  219.         }
  220.     } else { 
  221.         int $which = `optionMenuGrp -q -sl timeOpts`;
  222.         int $updateAnimation = !`checkBoxGrp -query -value1 updateKeys`;
  223.         switch ($which) {
  224.             case 1: currentUnit -t game -updateAnimation $updateAnimation; break;
  225.             case 2: currentUnit -t film -updateAnimation $updateAnimation; break;
  226.             case 3: currentUnit -t pal -updateAnimation $updateAnimation; break;
  227.             case 4: currentUnit -t ntsc -updateAnimation $updateAnimation; break;
  228.             case 5: currentUnit -t show -updateAnimation $updateAnimation; break;
  229.             case 6: currentUnit -t palf -updateAnimation $updateAnimation; break;
  230.             case 7: currentUnit -t ntscf -updateAnimation $updateAnimation; break;
  231.             case 8: currentUnit -t millisec -updateAnimation $updateAnimation; break;
  232.             case 9: currentUnit -t sec -updateAnimation $updateAnimation; break;
  233.             case 10: currentUnit -t min -updateAnimation $updateAnimation; break;
  234.             case 11: currentUnit -t hour -updateAnimation $updateAnimation; break;
  235.         }
  236.         // Reset the state of the updateKeys checkBox
  237.         //
  238.         checkBoxGrp -edit
  239.             -value1 off
  240.             updateKeys;
  241.         
  242.         // Changing the current time unit has side
  243.         // effects so we need to update some optionVars
  244.         optionVar 
  245.             -fv playbackMin `playbackOptions -q -min`
  246.             -fv playbackMax `playbackOptions -q -max`;
  247.     }
  248. }
  249.  
  250. global proc dynPrefSetRunup( int $state ) 
  251. //
  252. //  Description:
  253. //     Set the state of the runup preference.
  254. //
  255. {
  256.     dynPref -rt $state;
  257.     radioButtonGrp -e -enable $state dynRunupFrom;
  258. }
  259.  
  260.  
  261. global proc prefWndAnimOptionChanged( int $setSpeed ) 
  262. {
  263.     global string $gPreferenceWindow;
  264.     setParent $gPreferenceWindow;
  265.  
  266.     int        $which;
  267.     float    $speed;
  268.     int        $enableBy = 0;
  269.     float   $otherVal = `floatField -query -value playbackSpeedFF`;
  270.  
  271.     $which = `optionMenu -q -sl speedOpts`;
  272.     switch ($which) {
  273.         case 1: $speed = 0.0; $enableBy = 1; break;
  274.         case 2: $speed = 1.0; break;
  275.         case 3: $speed = 0.5; break;
  276.         case 4: $speed = 2.0; break;
  277.         case 5: $speed = $otherVal; break;
  278.         default: $speed = 0.0; break;
  279.     }
  280.  
  281.     if( $setSpeed ) {
  282.         playbackOptions -playbackSpeed $speed;
  283.         text -edit -enable ($which == 5) playbackSpeedT;
  284.         floatField -edit -enable ($which == 5) playbackSpeedFF;
  285.         rowLayout -edit -enable $enableBy playbackByRow;
  286.     }
  287.  
  288.     // Now update the UI to indicate the frames-per-second values as well
  289.     //
  290.     string $unit = `currentUnit -q -time`;
  291.     float  $fps = 0;
  292.  
  293.     if( $unit == "game" ) {
  294.         $fps = 15;
  295.     } else if( $unit == "film" ) {
  296.         $fps = 24;
  297.     } else if( $unit == "pal" ) {
  298.         $fps = 25;
  299.     } else if( $unit == "ntsc" ) {
  300.         $fps = 30;
  301.     } else if( $unit == "show" ) {
  302.         $fps = 48;
  303.     } else if( $unit == "palf" ) {
  304.         $fps = 50;
  305.     } else if( $unit == "ntscf" ) {
  306.         $fps = 60;
  307.     }
  308.  
  309.     // Only change the labels on the menu items if it makes
  310.     // sense to.
  311.     //
  312.     string $realTimeLabel = "Real-time";
  313.     string $halfTimeLabel = "Half";
  314.     string $twiceTimeLabel = "Twice";
  315.     string $otherTimeLabel = "Other";
  316.     
  317.     if( $fps != 0 ) {
  318.         $realTimeLabel += (" [" + ($fps*1.0) + " fps]");
  319.         $halfTimeLabel += (" [" + ($fps*0.5) + " fps]");
  320.         $twiceTimeLabel += (" [" + ($fps*2) + " fps]");
  321.         if( ! equivalent( 0.0, $otherVal ) ) {
  322.             $otherTimeLabel += (" [" + ($fps*$otherVal) + " fps]");
  323.         }
  324.     }
  325.  
  326.     menuItem -e -l ("Play every frame") playbackSpeedFree;
  327.     menuItem -e -l $realTimeLabel playbackSpeedNormal;
  328.     menuItem -e -l $halfTimeLabel playbackSpeedHalf;
  329.     menuItem -e -l $twiceTimeLabel playbackSpeedTwice;
  330.     menuItem -e -l $otherTimeLabel playbackSpeedOther;
  331.  
  332.     //    Update the playbackSpeed HUD.
  333.     //
  334.     if (`exists updatePlaybackSpeedHUD`) {
  335.         updatePlaybackSpeedHUD();
  336.     }
  337. }
  338.  
  339. global proc prefSelectPriorListChanged() 
  340. {
  341.     global string $gPreferenceWindow;
  342.     setParent $gPreferenceWindow;
  343.  
  344.     string $selected[] = `textScrollList -q -si priorList`;
  345.     int $val = eval("selectPriority -q -"+$selected[0]);
  346.     intFieldGrp -e -v1 $val priorVal;
  347. }
  348.  
  349. global proc prefSelectPriorValChanged()
  350. {
  351.     global string $gSelItems[];
  352.     global int $gCustomSelPriority[];
  353.     global string $gPreferenceWindow;
  354.     setParent $gPreferenceWindow;
  355.  
  356.     string $selected[] = `textScrollList -q -si priorList`;
  357.     int    $selIndex[] = `textScrollList -q -sii priorList`;
  358.     string $type;
  359.     int    $val;
  360.     int    $i = 0;
  361.  
  362.     // Update each selected priority.
  363.     //
  364.     for ($type in $selected) {
  365.         $val = `intFieldGrp -q -v1 priorVal`;
  366.         eval("selectPriority -"+$selected[$i] +" "+ $val);
  367.  
  368.         // If we're saving custom priorities, then record the change
  369.         //
  370.         if ("Custom" == `optionMenu -q -v presetOpts`) {
  371.  
  372.             // Because the elements of $gCustomSelPriority correspond to the
  373.             // ordering used in $gSelItems and _not_ alphabetical ordering, then
  374.             // we must find the proper non-alphabetical index to set the value.
  375.             //
  376.             int $optionVarIndex;
  377.             for($optionVarIndex = 0; $optionVarIndex < size($gSelItems); $optionVarIndex++) {
  378.                 if($gSelItems[$optionVarIndex] == $type) {
  379.                     $gCustomSelPriority[$optionVarIndex] = $val;
  380.                     break;
  381.                 }
  382.             }
  383.         }
  384.         $i++;
  385.     }
  386. }
  387.  
  388. global proc prefSelectPriorModeChanged()
  389. {
  390.     global string $gPreferenceWindow;
  391.     setParent $gPreferenceWindow;
  392.     
  393.     int $priorityPreset = `optionMenu -q -sl presetOpts`;
  394.     switch ($priorityPreset) {
  395.     case 1:        // Custom
  396.         selPriority "custom";
  397.         intFieldGrp -e -en true priorVal;
  398.         break;
  399.     case 2:        // Anim
  400.         selPriority "animation";
  401.         intFieldGrp -e -en false priorVal;
  402.         break;
  403.     case 3:        // NURBS
  404.         selPriority "nurbs";
  405.         intFieldGrp -e -en false priorVal;
  406.         break;
  407.     case 4:        // Render
  408.         selPriority "rendering";
  409.         intFieldGrp -e -en false priorVal;
  410.         break;
  411.     case 5:        // Dynamics
  412.         selPriority "dynamics";
  413.         intFieldGrp -e -en false priorVal;
  414.         break;
  415.     }
  416.  
  417.     string $selected[] = `textScrollList -q -si priorList`;
  418.     int $val = eval("selectPriority -q -"+$selected[0]);
  419.     intFieldGrp -e -v1 $val priorVal;
  420. }
  421.  
  422. global proc prefsChangeOutputType(int $mode)
  423. {
  424.     global string $gPreferenceWindow;
  425.     setParent $gPreferenceWindow;
  426.  
  427.     string $goAhead = "OK";
  428.     int $curType = `modelWithType (-1)`;
  429.  
  430.     // If the current type is 'mixed' then warning the user
  431.     
  432.     if ($curType == -1) {
  433.         string $theMessage =
  434.             "Changing the output geometry type will override the individual values "+
  435.             "set through the Option Boxes.\n"+
  436.             "This action is not undoable "+
  437.             "and Revert or Cancel will not reset these values.\n\n"+
  438.             "Do you want to make this change?";
  439.             
  440.         $goAhead = `confirmDialog -t "Information"
  441.             -messageAlign "left"
  442.             -message  $theMessage
  443.             -button "OK"
  444.             -button "Cancel"
  445.             -defaultButton "Cancel"
  446.             -cancelButton "Cancel"
  447.             -parent $gPreferenceWindow`;
  448.     }
  449.     
  450.     if ($goAhead == "OK") {
  451.         modelWithType($mode);
  452.         radioButtonGrp -e -enable 0 modelWithType5;
  453.     } else {
  454.         // Reset the 'mixed' button
  455.         radioButtonGrp -e -sl 1 -enable 1 modelWithType5;
  456.     }
  457. }
  458.  
  459.  
  460. global proc prefsChangeToolType(int $mode)
  461. {
  462.     global string $gPreferenceWindow;
  463.     setParent $gPreferenceWindow;
  464.  
  465.     string $goAhead = "OK";
  466.     int $curType = `modelWithToolsAll (-1)`;
  467.  
  468.     // If the current type is 'mixed' then warning the user
  469.     
  470.     if ($curType == -1) {
  471.         string $theMessage =
  472.             "Changing the interaction type will override the individual values "+
  473.             "set through the Option Boxes.\n"+
  474.             "This action is not undoable "+
  475.             "and Revert or Cancel will not reset these values.\n\n"+
  476.             "Do you want to make this change?";
  477.             
  478.         $goAhead = `confirmDialog -t "Information"
  479.             -messageAlign "left"
  480.             -message  $theMessage
  481.             -button "OK"
  482.             -button "Cancel"
  483.             -defaultButton "Cancel"
  484.             -cancelButton "Cancel"
  485.             -parent $gPreferenceWindow`;
  486.     }
  487.     
  488.     if ($goAhead == "OK") {
  489.         modelWithToolsAll($mode);
  490.         radioButtonGrp -e -enable 0 modelWithTools3;
  491.     } else {
  492.         // Reset the 'mixed' button
  493.         radioButtonGrp -e -sl 1 -enable 1 modelWithTools3;
  494.     }
  495. }
  496.  
  497. global proc prefsChangeNodeNameScheme(int $mode)
  498. {
  499.  
  500.     modelNodeNameScheme($mode);
  501.  
  502. }
  503.  
  504. global proc prefPolyChangeMaterial ()
  505. {
  506.     global string $gPreferenceWindow;
  507.     setParent $gPreferenceWindow;
  508.  
  509.     int $i = `optionMenuGrp -q -sl colorMaterialPopup`; 
  510.     if ($i==1) 
  511.         polyOptions -np -cm "none"; 
  512.     else if ($i==2) 
  513.         polyOptions -np -cm "ambient"; 
  514.     else if ($i==3) 
  515.         polyOptions -np -cm "ambientDiffuse"; 
  516.     else if ($i==4) 
  517.         polyOptions -np -cm "diffuse"; 
  518.     else if ($i==5) 
  519.         polyOptions -np -cm "specular"; 
  520.     else if ($i==6) 
  521.         polyOptions -np -cm "emission";
  522. }
  523.  
  524. global proc prefPolyUpdateCulling ()
  525. {
  526.     global string $gPreferenceWindow;
  527.     setParent $gPreferenceWindow;
  528.  
  529.     int $backfaceCulling = `optionMenuGrp -q -select polyFBackCullPopup`;
  530.     checkBoxGrp -edit -enable3 ($backfaceCulling != 1) polyVertDispCheck;    
  531. }
  532.  
  533. global proc prefPolyChangeCulling ()
  534. {
  535.     global string $gPreferenceWindow;
  536.     setParent $gPreferenceWindow;
  537.  
  538.     int $val = `optionMenuGrp -q -sl polyFBackCullPopup`; 
  539.     if ($val == 1) {
  540.         polyOptions -np -bc; 
  541.     } else if ($val == 2) {
  542.         polyOptions -np -fb; 
  543.     } else if ($val == 3) {
  544.         polyOptions -np -wbc; 
  545.     } else if ($val == 4) {
  546.         polyOptions -np -hb; 
  547.     }
  548.     prefPolyUpdateCulling;
  549. }
  550.  
  551. global proc prefAnimTimeCodeChanged() 
  552. {
  553.     global string $gPreferenceWindow;
  554.     setParent $gPreferenceWindow;
  555.  
  556.     int $isTimeCode = `checkBoxGrp -q -v1 timeLine`;
  557.     textFieldGrp -e -enable $isTimeCode timeCodeOffset;
  558. }
  559.  
  560. global proc prefAnimTangentsChanged( int $inTangent ) 
  561. {
  562.     global string $gPreferenceWindow;
  563.     setParent $gPreferenceWindow;
  564.  
  565.     string $widget = $inTangent == 1 ? "inTangentType" : "outTangentType";
  566.     string $flag   = $inTangent == 1 ? "-itt" : "-ott";
  567.     string $type   = "spline";
  568.     int    $value  = `optionMenuGrp -q -select $widget`;
  569.     
  570.     switch( $value ) {
  571.         case 1:
  572.             $type = "spline";
  573.             break;
  574.         case 2:
  575.             $type = "linear";
  576.             break;
  577.         case 3:
  578.             $type = "clamped";
  579.             break;
  580.         case 4:
  581.             $type = "flat";
  582.             break;
  583.         case 5:
  584.             $type = "step";
  585.             break;
  586.         default:
  587.             break;
  588.     }
  589.  
  590.     evalEcho( "keyTangent -global " + $flag + " " + $type );
  591. }
  592.  
  593. global proc prefAutoKeyCharacterChanged()
  594. {
  595.     int    $value  = `optionMenuGrp -q -select autoKeyCharacter`;
  596.     string $type   = "standard";
  597.  
  598.     switch( $value ) {
  599.         case 1:
  600.             $type = "standard";
  601.             break;
  602.         case 2:
  603.             $type = "all";
  604.             break;
  605.     }
  606.  
  607.     evalEcho( "autoKeyframe -characterOption "+$type );
  608. }
  609.  
  610. global proc prefWndHelpLanguageChanged( int $inSelected ) 
  611. {
  612.     global string $gHelpLanguage;
  613.     
  614.     switch( $inSelected) {
  615.         case 1:
  616.             $gHelpLanguage = "en_US"; 
  617.             textFieldGrp -e -enable false helpLanguageSpecify;
  618.             break;
  619.         case 2:
  620.             $gHelpLanguage = "ja_JP"; 
  621.             textFieldGrp -e -enable false helpLanguageSpecify;
  622.             break;
  623.         case 3:
  624.             $gHelpLanguage = `textFieldGrp -q -text helpLanguageSpecify`; 
  625.             textFieldGrp -e -enable true helpLanguageSpecify;
  626.             break;
  627.     }
  628.     
  629.     textFieldGrp -e -text $gHelpLanguage helpLanguageSpecify;
  630. }
  631.  
  632. global proc prefWndHelpLocationChanged( int $inSelected ) 
  633. {
  634.     string $helpLocationStr;
  635.     
  636.     switch( $inSelected) {
  637.         case 1:
  638.             $helpLocationStr = ""; 
  639.             textFieldGrp -e -enable false helpUrlField;
  640.             break;
  641.         case 2:
  642.             $helpLocationStr = `optionVar -q remoteHelpUrl`; 
  643.             textFieldGrp -e -enable true helpUrlField;
  644.             break;
  645.         case 3:
  646.             $helpLocationStr = `textFieldGrp -q -text helpUrlField`; 
  647.         break;
  648.     }
  649.     
  650.     optionVar -sv helpUrl $helpLocationStr;
  651.     optionVar -sv remoteHelpUrl `textFieldGrp -q -text helpUrlField`;
  652. }
  653.  
  654. //----------------------------------------------------------------
  655. //
  656. //    Begin section of creation procedures
  657. //
  658. //----------------------------------------------------------------
  659.  
  660. global proc prefsCreateAppearance() 
  661. {
  662.     global string $gPreferenceWindow;
  663.     global string $gMainWindow;
  664.     global string $gCommandWindow;
  665.  
  666.     setParent $gPreferenceWindow;
  667.     string $parent = "prefAppearCol";
  668.     
  669.     // Check to see if this has been created already.
  670.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  671.         return;
  672.     }
  673.  
  674.     //  Create the UI
  675.     //
  676.     setParent $parent;
  677.     setUITemplate -pushTemplate prefsTemplate;
  678.  
  679.     // This is used to force the width to fill the window
  680.     separator -style "none" -h 1 -w 490;
  681.  
  682.     frameLayout -l "Interface";
  683.         columnLayout -adj true;
  684.  
  685.             optionMenuGrp -l "Menu Set" 
  686.                 -cc "prefApplyWorkingMode" 
  687.                 modeOpts;
  688.  
  689.                 menuItem -l "Animation";
  690.                 menuItem -l "Modeling";
  691.                 menuItem -l "Dynamics";
  692.                 menuItem -l "Rendering";
  693.  
  694.         if (`about -mac`) 
  695.         {
  696.             //    Fix for Bug #156604
  697.             //    On the Mac - We do-not provide an option to show/hide Main Menubar
  698.             //    as this is a *really *nasty thing to do*. It is really only 
  699.             //    intended for games and such which want to go into fullscreen mode
  700.             //
  701.             checkBoxGrp -ncb 1 
  702.             -cw 2 220
  703.             -l "Show Menubar" 
  704.             -h 2
  705.             -visible false
  706.             -l1 "In Main Window"
  707.             -cc "window -e -mbv #1 $gMainWindow"
  708.             mainMenubarCheck1;
  709.             
  710.             checkBoxGrp -ncb 1 
  711.                 -l "Show Menubar"
  712.                 -cw 2 100
  713.                 -label1 "In Panels"
  714.                 -cc "toggleMenuBarsInPanels #1"
  715.                 showMenuBarChk;
  716.  
  717.             //    We do not support showing/hiding of the Title Bar
  718.             //    If you hide the title bar, the user has no way to 'move' the window.
  719.             //
  720.             checkBoxGrp -ncb 1 
  721.                 -cw 2 220
  722.                 -l "Show Title Bar" 
  723.                 -l1 "In Main Window"
  724.                 -h  1
  725.                 -visible false
  726.                 -cc "window -e -titleBar #1 $gMainWindow"
  727.                 mainTitleCheck1;
  728.  
  729.             checkBoxGrp -ncb 1 
  730.                 -cw 2 220
  731.                 -l " " 
  732.                 -l1 "In Script Editor"
  733.                 -h  1
  734.                 -visible false
  735.                 -cc "window -e -titleBar #1 $gCommandWindow"
  736.                 cmdTitleCheck1;
  737.         }
  738.         else {
  739.             checkBoxGrp -ncb 1 
  740.                 -cw 2 220
  741.                 -l "Show Menubar" 
  742.                 -l1 "In Main Window"
  743.                 -cc "window -e -mbv #1 $gMainWindow"
  744.                 mainMenubarCheck1;
  745.                 
  746.             checkBoxGrp -ncb 1 
  747.                 -l " "
  748.                 -cw 2 100
  749.                 -label1 "In Panels"
  750.                 -cc "toggleMenuBarsInPanels #1"
  751.                 showMenuBarChk;
  752.  
  753.             checkBoxGrp -ncb 1 
  754.                 -cw 2 220
  755.                 -l "Show Title Bar" 
  756.                 -l1 "In Main Window"
  757.                 -cc "window -e -titleBar #1 $gMainWindow"
  758.                 mainTitleCheck1;
  759.  
  760.             checkBoxGrp -ncb 1 
  761.                 -cw 2 220
  762.                 -l " " 
  763.                 -l1 "In Script Editor"
  764.                 -cc "window -e -titleBar #1 $gCommandWindow"
  765.                 cmdTitleCheck1;
  766.         }
  767.  
  768.         checkBoxGrp -ncb 1
  769.             -cw 2 200
  770.             -l "Windows"
  771.             -l1 "Remember Size and Position" 
  772.             -cc1 "windowPref -enableAll #1" 
  773.             winPrefChk;
  774.                     
  775.         checkBoxGrp -ncb 1
  776.             -l "Command Line"
  777.             -l1 "Hold Focus" 
  778.             -on1 "optionVar -iv commandLineHoldFocus true; commandLine -e -c \"\" $gCommandLine"
  779.             -of1 "optionVar -iv commandLineHoldFocus false; commandLine -e -c \"setFocus `paneLayout -q -p1 viewPanes`\" $gCommandLine"
  780.             focusCheck;
  781.  
  782.         radioButtonGrp -nrb 1
  783.             -cw 2 200
  784.             -l "Open Attribute Editor"
  785.             -l1 "In Separate Window"
  786.             -on1 "optionVar -iv aeInMainWindow 0"
  787.             aeInWindowPrefChk1;
  788.         
  789.         radioButtonGrp -nrb 1
  790.             -scl aeInWindowPrefChk1
  791.             -cw 2 200
  792.             -l " "
  793.             -l1 "In Main Maya Window"
  794.             -on1 "optionVar -iv aeInMainWindow 1"
  795.             aeInWindowPrefChk2;
  796.  
  797.         radioButtonGrp -numberOfRadioButtons 1
  798.             -columnWidth     2 200
  799.             -label           "Open Tool Settings"
  800.             -label1          "In Separate Window"
  801.             -onCommand1      "optionVar -intValue toolSettingsInMainWindow false"
  802.             toolSettingsInWindowPrefChk1;
  803.         
  804.         radioButtonGrp -numberOfRadioButtons 1
  805.             -shareCollection toolSettingsInWindowPrefChk1
  806.             -columnWidth     2 200
  807.             -label           ""
  808.             -label1          "In Main Maya Window"
  809.             -onCommand1      "optionVar -intValue toolSettingsInMainWindow true"
  810.             toolSettingsInWindowPrefChk2;
  811.  
  812.         optionMenuGrp -l "Expression Editor" 
  813.             -cc "prefExprEdTextEditor 0"
  814.             textEdOpts;
  815.  
  816.             menuItem -l "Expression Editor";
  817.             if (`about -nt`) {
  818.                 menuItem -l "Text Editor";
  819.             } else if (`about -irix`) {
  820.                 menuItem -l "jot";
  821.                 menuItem -l "vi";
  822.                 menuItem -l "vim";
  823.                 menuItem -l "xemacs";
  824.                 menuItem -l "Other";
  825.             } else if (`about -linux`) {
  826.                 menuItem -l "emacs";
  827.                 menuItem -l "gvim";
  828.                 menuItem -l "vi";
  829.                 menuItem -l "vim";
  830.                 menuItem -l "xedit";
  831.                 menuItem -l "xemacs";
  832.                 menuItem -l "Other";
  833.             }
  834.  
  835.             if (`about -mac`) {
  836.                 radioButtonGrp -nrb 3
  837.                     -l "Mouse Tracking"
  838.                     -cw 2 100 -cw 3 100
  839.                     -la3 "One Button" "Two Button" "Three Button"
  840.                     -on1 "optionVar -iv mayaMacButtonMap 1"
  841.                     -on2 "optionVar -iv mayaMacButtonMap 2"
  842.                     -on3 "optionVar -iv mayaMacButtonMap 3"
  843.                     mouseTracking;
  844.             }
  845.  
  846.      setParent $parent;
  847.  
  848.     setUITemplate -popTemplate;
  849.  
  850.     prefsUpdateAppearance();
  851. }
  852.  
  853.  
  854. global proc prefsCreateElements() 
  855. {
  856.     global string $gPreferenceWindow;
  857.     setParent $gPreferenceWindow;
  858.     string $parent = "prefElementsCol";
  859.     
  860.     // Check to see if this has been created already.
  861.     //
  862.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  863.         return;
  864.     }
  865.  
  866.     //  Create the UI
  867.     //
  868.     setParent $parent;
  869.     setUITemplate -pushTemplate prefsTemplate;
  870.  
  871.     // This is used to force the width to fill the window
  872.     separator -style "none" -h 1 -w 490;
  873.  
  874.     frameLayout -l "Visible UI Elements";
  875.         columnLayout -adj true;
  876.  
  877.             checkBoxGrp -ncb 1
  878.                 -label         ""
  879.                 -label1        "Status Line"
  880.                 -columnWidth   2 250
  881.                 -changeCommand "setStatusLineVisible #1" 
  882.                 statusLineCheckBox;
  883.  
  884.             checkBoxGrp -ncb 1
  885.                 -label         ""
  886.                 -label1        "Shelf"
  887.                 -columnWidth   2 250
  888.                 -changeCommand "setShelfVisible #1" 
  889.                 shelfCheckBox;
  890.  
  891.             checkBoxGrp -ncb 1
  892.                 -label         ""
  893.                 -label1        "Time Slider"
  894.                 -columnWidth   2 250
  895.                 -changeCommand "setTimeSliderVisible #1" 
  896.                 timeSliderCheckBox;
  897.  
  898.             checkBoxGrp -ncb 1
  899.                 -label         ""
  900.                 -label1        "Range Slider"
  901.                 -columnWidth   2 250
  902.                 -changeCommand "setPlaybackRangeVisible #1" 
  903.                 playbackRangeCheckBox;
  904.  
  905.             checkBoxGrp -ncb 1
  906.                 -label         ""
  907.                 -label1        "Command Line"
  908.                 -columnWidth   2 250
  909.                 -changeCommand "setCommandLineVisible #1" 
  910.                 commandLineCheckBox;
  911.  
  912.             checkBoxGrp -ncb 1
  913.                 -label         ""
  914.                 -label1        "Help Line"
  915.                 -columnWidth   2 250
  916.                 -changeCommand "setHelpLineVisible #1" 
  917.                 helpLineCheckBox;
  918.  
  919.             checkBoxGrp -ncb 1
  920.                 -label         ""
  921.                 -label1        "Toolbox"
  922.                 -columnWidth   2 250
  923.                 -changeCommand "setToolboxVisible #1" 
  924.                 toolboxCheckBox;
  925.  
  926.             checkBoxGrp -ncb 1
  927.                 -label         ""
  928.                 -label1        "Attribute Editor"
  929.                 -columnWidth   2 250
  930.                 -changeCommand "setPrefAttrEditorVisible #1" 
  931.                 attributeEditorCheckBox;
  932.  
  933.             checkBoxGrp -ncb 1
  934.                 -label         ""
  935.                 -label1        "Tool Settings"
  936.                 -columnWidth   2 250
  937.                 -changeCommand "setPrefToolSettingsVisible #1" 
  938.                 toolSettingsCheckBox;
  939.  
  940.             checkBoxGrp -ncb 1
  941.                 -label         ""
  942.                 -label1        "Channel Box / Layer Editor"
  943.                 -columnWidth   2 250
  944.                 -changeCommand "setPrefChannelsLayersVisible #1" 
  945.                 channelsLayersCheckBox;
  946.  
  947.     setParent $parent;
  948.  
  949.     setUITemplate -popTemplate;
  950.  
  951.     prefsUpdateElements();
  952. }
  953.  
  954.  
  955. global proc prefsCreateWindows() 
  956. {
  957.     global string $gPreferenceWindow;
  958.     global int    $gRaiseHelpBrowserWin;
  959.     global string $gHelpLanguage;
  960.     global string $gNewScenePanelConfig;
  961.     global int      $gUseNewScenePanelConfig;
  962.     global int      $gUseScenePanelConfig;
  963.     global int      $gUseSaveScenePanelConfig;
  964.  
  965.     setParent $gPreferenceWindow;
  966.     string $parent = "prefWindowsCol";
  967.     
  968.     // Check to see if this has been created already.
  969.     //
  970.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  971.         return;
  972.     }
  973.  
  974.     //  Create the UI
  975.     //
  976.     setParent $parent;
  977.     setUITemplate -pushTemplate prefsTemplate;
  978.  
  979.     // This is used to force the width to fill the window
  980.     separator -style "none" -h 1 -w 490;
  981.  
  982.     frameLayout -l "Popup Help";
  983.         columnLayout -adj true;
  984.             int $extraLabelWidth;
  985.             if (`about -mac`) {
  986.                 // on Mac, adjust the width of extraLabel inorder to position it properly
  987.                 $extraLabelWidth = 60;
  988.             }
  989.             else {
  990.                 $extraLabelWidth = 100;
  991.             }
  992.             intFieldGrp
  993.                 -l "Display Time"
  994.                 -extraLabel "Seconds"
  995.                 -cw 3 $extraLabelWidth -columnAlign 3 "left"
  996.                 -cc "help -popupDisplayTime #1"
  997.                 popupHelpTime;
  998.  
  999.     setParent $parent;
  1000.  
  1001. // This UI removed in Maya 5.0.
  1002. //
  1003. //    separator -style "none" -h 5;
  1004. //
  1005. //    frameLayout -l "Help Browser";
  1006. //        columnLayout -adj true;
  1007. //            
  1008. //            radioButtonGrp -nrb 1
  1009. //                -l "Window Selection"
  1010. //                -l1 "Use an Existing Help Browser Window"
  1011. //                -on1 "$gUseHelpBrowserWin = true; $gHelpBrowserWinID =\"\";"
  1012. //                -cw 2 250
  1013. //                winRBG;
  1014. //
  1015. //            radioButtonGrp -nrb 1
  1016. //                -scl winRBG
  1017. //                -l " "
  1018. //                -l1 "Create a New Help Browser Window for Maya Help"
  1019. //                -on1 "$gUseHelpBrowserWin = false; $gHelpBrowserWinID =\"\";"
  1020. //                -cw 2 330
  1021. //                winRBG2;
  1022. //
  1023. //            checkBoxGrp -ncb 1
  1024. //                -l "Window Visibility"
  1025. //                -l1 "Raise Help Browser on a Help Request"
  1026. //                -cc1 "$gRaiseHelpBrowserWin = #1"
  1027. //                -cw 2 250
  1028. //                visCBG;
  1029.  
  1030. // Functionality removed before Maya 4.0 shipped.
  1031. // Needs better integration before being resurrected.
  1032. //
  1033. //            if (`about -nt`) {
  1034. //                radioButtonGrp -nrb 1
  1035. //                    -cw 2 200
  1036. //                    -l "Open Help"
  1037. //                    -l1 "Using External Browser"
  1038. //                    -on1 "optionVar -iv helpInMainWindow 0"
  1039. //                    helpInWindowPrefChk1;
  1040. //                
  1041. //                radioButtonGrp -nrb 1
  1042. //                    -scl helpInWindowPrefChk1
  1043. //                    -cw 2 200
  1044. //                    -l " "
  1045. //                    -l1 "In Main Maya Window"
  1046. //                    -on1 "optionVar -iv helpInMainWindow 1"
  1047. //                    helpInWindowPrefChk2;
  1048. //            }
  1049.  
  1050.     setParent $parent;
  1051.  
  1052.     separator -style "none" -h 5;
  1053.  
  1054.     frameLayout -l "Help Language";
  1055.         columnLayout -adj true;
  1056.  
  1057.             radioButtonGrp -nrb 1
  1058.                 -l ""
  1059.                 -l1 "English"
  1060.                 -on1 "prefWndHelpLanguageChanged(1);"
  1061.                 helpLanguageEnglish;
  1062.  
  1063.             radioButtonGrp -nrb 1
  1064.                 -scl helpLanguageEnglish
  1065.                 -l ""
  1066.                 -l1 "Japanese"
  1067.                 -on1 "prefWndHelpLanguageChanged(2);"
  1068.                 helpLanguageJapanese;
  1069.  
  1070.             radioButtonGrp -nrb 1
  1071.                 -scl helpLanguageEnglish
  1072.                 -l ""
  1073.                 -l1 "Other"
  1074.                 -on1 "prefWndHelpLanguageChanged(3);"
  1075.                 helpLanguageOther;
  1076.                 
  1077.             textFieldGrp
  1078.                 -l "Specify language"
  1079.                 -cc "$gHelpLanguage = `textFieldGrp -q -text helpLanguageSpecify`;"
  1080.                 helpLanguageSpecify;
  1081.  
  1082.     setParent $parent;
  1083.  
  1084.     separator -style "none" -h 5;
  1085.  
  1086.     frameLayout -l "Help Location";
  1087.         columnLayout -adj true;
  1088.  
  1089.             radioButtonGrp -nrb 1
  1090.                 -l ""
  1091.                 -l1 "Local"
  1092.                 -on1 "prefWndHelpLocationChanged(1);"
  1093.                 helpLocationLocal;
  1094.  
  1095.             radioButtonGrp -nrb 1
  1096.                 -scl helpLocationLocal
  1097.                 -l ""
  1098.                 -l1 "Remote"
  1099.                 -on1 "prefWndHelpLocationChanged(2);"
  1100.                 helpLocationRemote;
  1101.  
  1102.             textFieldGrp
  1103.                 -l "URL"
  1104.                 -cc "prefWndHelpLocationChanged(3);"
  1105.                 helpUrlField;
  1106.  
  1107.             string $envVar = `getenv "MAYA_HELP_URL"`;
  1108.             if ( size( $envVar ) > 0 )
  1109.             {
  1110.                 text -al "left" -l " Set from env variable MAYA_HELP_URL";
  1111.             }
  1112.  
  1113.     setParent $parent;
  1114.  
  1115.     separator -style "none" -h 5;
  1116.  
  1117.     frameLayout -l "Panel Configurations" sConfig;
  1118.         columnLayout -adj true sfConfig;
  1119.  
  1120.             checkBoxGrp -ncb 1 -l "When Saving"
  1121.                 -l1 "Save Panel Layouts with File"
  1122.                 -on1 "$gUseSaveScenePanelConfig = true; file -uc true;"
  1123.                 -of1 "$gUseSaveScenePanelConfig = false;file -uc false;"
  1124.                 -cw 2 300
  1125.                 saveConfig;
  1126.  
  1127.             checkBoxGrp -ncb 1 -l "When Opening"
  1128.                 -l1 "Restore Saved Layouts from File"
  1129.                 -on1 "$gUseScenePanelConfig = true; file -uc true;"
  1130.                 -of1 "$gUseScenePanelConfig = false;file -uc false;"
  1131.                 -cw 2 300
  1132.                 openConfig;
  1133.              
  1134.             radioButtonGrp -nrb 1 -l "Starting New Scenes"
  1135.                 -l1 "Keep Current Layout"
  1136.                 -on1 "$gUseNewScenePanelConfig = false;"
  1137.                 -cw 2 300
  1138.                 newConfig1;
  1139.              
  1140.             radioButtonGrp -nrb 1 -l ""
  1141.                 -scl newConfig1                
  1142.                 -l1 "Use Layout Specified Below"
  1143.                 -on1 "$gUseNewScenePanelConfig = true;"
  1144.                 -cw 2 300
  1145.                 newConfig2;
  1146.  
  1147.             optionMenuGrp -l ""
  1148.                 -cc "$gNewScenePanelConfig = \"#1\""
  1149.                 configOpts;
  1150.  
  1151.     setParent $parent;
  1152.  
  1153.     setUITemplate -popTemplate;
  1154.  
  1155.     prefsUpdateWindows();
  1156. }
  1157.  
  1158. global proc updateGhostData(int $which, int $val)
  1159. {
  1160.     int $curr[] = `displayPref -q -ghostFrames`;
  1161.     if (0 == $which) {
  1162.         displayPref -ghostFrames $val $curr[1] $curr[2];
  1163.     } else if (1 == $which) {
  1164.         displayPref -ghostFrames $curr[0] $val $curr[2];        
  1165.     } else {
  1166.         displayPref -ghostFrames $curr[0] $curr[1] $val;        
  1167.     }
  1168. }
  1169.  
  1170.  
  1171. global proc prefsCreateDisplay() 
  1172. {
  1173.     global string $gPreferenceWindow;
  1174.     setParent $gPreferenceWindow;
  1175.     string $parent = "prefDisplayCol";
  1176.     
  1177.     // Check to see if this has been created already.
  1178.     //
  1179.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1180.         return;
  1181.     }
  1182.  
  1183.     //  Create the UI
  1184.     //
  1185.     setParent $parent;
  1186.     setUITemplate -pushTemplate prefsTemplate;
  1187.  
  1188.     // This is used to force the width to fill the window
  1189.     separator -style "none" -h 1 -w 490;
  1190.  
  1191.     frameLayout -l "Performance";
  1192.         columnLayout -adj true;
  1193.  
  1194.             radioButtonGrp -nrb 2
  1195.                 -l "Fast Interaction" 
  1196.                 -la2 "On" "Off"
  1197.                 -on1 "if (!`exists gridMenuUpdate`) {source buildDisplayMenu;} doFastInteractionItem on"
  1198.                 -on2 "if (!`exists gridMenuUpdate`) {source buildDisplayMenu;} doFastInteractionItem off"
  1199.                 fastRBG;
  1200.  
  1201.     setParent $parent;
  1202.  
  1203.     separator -style "none" -h 5;
  1204.  
  1205.     frameLayout -l "View";
  1206.         columnLayout -adj true;
  1207.  
  1208.             checkBoxGrp -numberOfCheckBoxes 2
  1209.                 -label "Axes" 
  1210.                 -labelArray2 "View Axis" "Origin Axis"
  1211.                 -changeCommand1 "ToggleViewAxis"
  1212.                 -changeCommand2 "ToggleOriginAxis"
  1213.                 axisCBG;
  1214.  
  1215.             radioButtonGrp -nrb 2
  1216.                 -l "Grid Plane" 
  1217.                 -la2 "Show" "Hide"
  1218.                 -on1 "grid -tgl on"
  1219.                 -on2 "grid -tgl off"
  1220.                 gridRBG;
  1221.  
  1222.             radioButtonGrp -nrb 2
  1223.                 -l "Active Object Pivots" 
  1224.                 -la2 "On" "Off"
  1225.                 -on1 "displayPref -activeObjectPivots true"
  1226.                 -on2 "displayPref -activeObjectPivots false"
  1227.                 activeObjectPivotsRBG;
  1228.  
  1229.             radioButtonGrp -nrb 2
  1230.                 -l "Affected Highlighting" 
  1231.                 -la2 "On" "Off"
  1232.                 -on1 "displayPref -displayAffected true"
  1233.                 -on2 "displayPref -displayAffected false"
  1234.                 affectedRBG;
  1235.  
  1236.             radioButtonGrp -nrb 3
  1237.                 -l "Wireframe on Shaded" 
  1238.                 -la3 "Full" "Reduced" "None"
  1239.                 -on1 "displayPref -wsa \"full\""
  1240.                 -on2 "displayPref -wsa \"reduced\""
  1241.                 -on3 "displayPref -wsa \"none\""
  1242.                 wireframeOnShadedActiveRBG;
  1243.  
  1244.             radioButtonGrp -nrb 2
  1245.                 -l "Region of Effect" 
  1246.                 -la2 "On" "Off"
  1247.                 -on1 "displayPref -regionOfEffect true"
  1248.                 -on2 "displayPref -regionOfEffect false"
  1249.                 regionOfEffectRBG;
  1250.  
  1251.             radioButtonGrp -nrb 2
  1252.                 -l "Shade Templates" 
  1253.                 -la2 "On" "Off"
  1254.                 -on1 "displayPref -shadeTemplates true"
  1255.                 -on2 "displayPref -shadeTemplates false"
  1256.                 shadeTemplatesRBG;
  1257.  
  1258.     setParent $parent;
  1259.  
  1260.     setUITemplate -popTemplate;
  1261.  
  1262.     prefsUpdateDisplay();
  1263. }
  1264.  
  1265. global proc prefsCreateNURBS() 
  1266. {
  1267.     global string $gPreferenceWindow;
  1268.     setParent $gPreferenceWindow;
  1269.     string $parent = "prefNURBSCol";
  1270.     
  1271.     // Check to see if this has been created already.
  1272.     //
  1273.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1274.         return;
  1275.     }
  1276.  
  1277.     int $hasSurfaces = `isTrue SurfaceUIExists`;
  1278.  
  1279.     //  Create the UI
  1280.     //
  1281.     setParent $parent;
  1282.     setUITemplate -pushTemplate prefsTemplate;
  1283.  
  1284.     // This is used to force the width to fill the window
  1285.     separator -style "none" -h 1 -w 490;
  1286.  
  1287.     frameLayout -l "NURBS Display";
  1288.         columnLayout -adj true;
  1289.  
  1290.             checkBoxGrp -ncb 3
  1291.                 -l "New Curves" 
  1292.                 -la3 "Edit Points" "Hulls" "CVs"
  1293.                 -cc1 "toggle -nc -ep -state #1"
  1294.                 -cc2 "toggle -nc -hull -state #1"
  1295.                 -cc3 "toggle -nc -cv -state #1"
  1296.                 controlCBG1;
  1297.  
  1298.         if( $hasSurfaces ) {
  1299.             checkBoxGrp -ncb 2
  1300.                 -l "New Surfaces" 
  1301.                 -la2 "Edit Points" "Hulls" 
  1302.                 -cc1 "toggle -ns -ep -state #1"
  1303.                 -cc2 "toggle -ns -hull -state #1"
  1304.                 controlNewSurface1;
  1305.  
  1306.             checkBoxGrp -ncb 2
  1307.                 -l "" 
  1308.                 -la2 "CVs" "Origins"
  1309.                 -cc1 "toggle -ns -cv -state #1"
  1310.                 -cc2 "toggle -ns -origin -state #1"
  1311.                 controlNewSurface2;
  1312.             
  1313.             intSliderGrp -field true
  1314.                 -label "Surface Divisions"
  1315.                 -min 0 -max 16 -fmx 64
  1316.                 -cc "displaySmoothness -dc -du #1;displaySmoothness -dc -dv #1;"
  1317.                 nurbsDivUV;
  1318.         }
  1319.  
  1320.             intSliderGrp -field true
  1321.                 -label "Curve Divisions"
  1322.                 -min 1 -max 64 -fmx 128
  1323.                 -cc "displaySmoothness -dc -pw #1"
  1324.                 nurbsDivW;
  1325.  
  1326.         if( $hasSurfaces ) {
  1327.             intSliderGrp -field true
  1328.                 -label "Shaded Divisions"
  1329.                 -min 1 -max 16 -fmx 64
  1330.                 -cc "displaySmoothness -dc -ps #1"
  1331.                 nurbsDivS;
  1332.         }
  1333.  
  1334.     setParent $parent;
  1335.  
  1336.     setUITemplate -popTemplate;
  1337.  
  1338.     prefsUpdateNURBS();
  1339. }
  1340.  
  1341. global proc prefsCreatePolys() 
  1342. {
  1343.     global string $gPreferenceWindow;
  1344.     setParent $gPreferenceWindow;
  1345.     string $parent = "prefPolysCol";
  1346.     
  1347.     // Check to see if this has been created already.
  1348.     //
  1349.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1350.         return;
  1351.     }
  1352.  
  1353.     if (!`isTrue "PolygonsExists"`) {
  1354.         return;
  1355.     }
  1356.  
  1357.     //  Create the UI
  1358.     //
  1359.     setParent $parent;
  1360.     setUITemplate -pushTemplate prefsTemplate;
  1361.  
  1362.     // This is used to force the width to fill the window
  1363.     separator -style "none" -h 1 -w 490;
  1364.  
  1365.     frameLayout -l "Polygon Display";
  1366.         columnLayout -adj true;
  1367.  
  1368.             // vertices drawing style
  1369.             checkBoxGrp -numberOfCheckBoxes 3
  1370.                 -label "Vertices"
  1371.                 -la3 "Display" "Normals" "Backculling"
  1372.                 -cc1 "polyOptions -np -dv #1"
  1373.                 -on2 "int $dv=`checkBoxGrp -q -v2 polyFacetDispCheck1`; int $v[] = `polyOptions -q -np -f`; if($dv) { if($v[0]) polyOptions -np -dn 1 -pf; else polyOptions -np -dn 1 -pt; } else polyOptions -np -dn 1 -pt"
  1374.                 -of2 "int $dv=`checkBoxGrp -q -v2 polyFacetDispCheck1`; if($dv) polyOptions -np -dn 1 -f; else polyOptions -np -dn 0;"
  1375.                 -cc3 "polyOptions -np -bcv #1"
  1376.                 polyVertDispCheck;
  1377.    
  1378.             separator;
  1379.             radioButtonGrp -numberOfRadioButtons 3
  1380.                 -label "Edges"
  1381.                 -la3 "Standard" "Soft/Hard" "Only Hard"
  1382.                 -cc1 "polyOptions -np -ae"
  1383.                 -cc2 "polyOptions -np -se"
  1384.                 -cc3 "polyOptions -np -he"
  1385.                 polyEdgeDispRadio;
  1386.  
  1387.             checkBoxGrp -numberOfCheckBoxes 2
  1388.                 -label "Highlight"
  1389.                 -l1 "Border Edges"
  1390.                 -l2 "Texture Borders"
  1391.                 -cw 3 140
  1392.                 -cc1 "polyOptions -np -db #1"
  1393.                 -cc2 "polyOptions -np -dmb #1"
  1394.                 polyBordEdgeHiliteDispCheck;
  1395.    
  1396.             floatSliderGrp -label "Border Width" -field true
  1397.                 /* -cal 1 left */ -min 1 -max 10
  1398.                 -cc "polyOptions -np -sb #1"
  1399.                 polyBordEdgeSizeSlider;
  1400.  
  1401.             separator;
  1402.  
  1403.             checkBoxGrp -numberOfCheckBoxes 2
  1404.                 -label "Faces"
  1405.                 -la2 "Centers" "Normals"
  1406.                 -cc1 "polyOptions -np -dc #1"
  1407.                 -on2 "int $dv=`checkBoxGrp -q -v2 polyVertDispCheck`; int $v[] = `polyOptions -q -np -pt`; if($dv) {if($v[0]) polyOptions -np -dn 1 -pf; else polyOptions -np -dn 1 -f; } else polyOptions -np -dn 1 -f"
  1408.                 -of2 "int $dv=`checkBoxGrp -q -v2 polyVertDispCheck`; if($dv) polyOptions -np -dn 1 -pt; else polyOptions -np -dn 0;"
  1409.                 polyFacetDispCheck1;
  1410.  
  1411.             checkBoxGrp -numberOfCheckBoxes 2
  1412.                 -label ""
  1413.                 -la2 "Triangles" "Non-planar"
  1414.                 -cc1 "polyOptions -np -dt #1"
  1415.                 -cc2 "polyOptions -np -dw #1"
  1416.                 polyFacetDispCheck2;
  1417.  
  1418.             separator;
  1419.             
  1420.             checkBoxGrp -numberOfCheckBoxes 2
  1421.                 -label "Show Item Numbers"
  1422.                 -la2 "Vertices" "Edges"
  1423.                 -cc "int $dv = `checkBoxGrp -q -v1 polyItemDispCheck1`;\
  1424.                      int $de = `checkBoxGrp -q -v2 polyItemDispCheck1`;\
  1425.                      int $df = `checkBoxGrp -q -v1 polyItemDispCheck2`;\
  1426.                      int $dm = `checkBoxGrp -q -v2 polyItemDispCheck2`;\
  1427.                      polyOptions -np -din $dv $de $df $dm; "
  1428.                 polyItemDispCheck1;
  1429.             
  1430.             checkBoxGrp -numberOfCheckBoxes 2
  1431.                 -label ""
  1432.                 -la2 "Faces" "UVs"
  1433.                 -cc "int $dv = `checkBoxGrp -q -v1 polyItemDispCheck1`;\
  1434.                      int $de = `checkBoxGrp -q -v2 polyItemDispCheck1`;\
  1435.                      int $df = `checkBoxGrp -q -v1 polyItemDispCheck2`;\
  1436.                      int $dm = `checkBoxGrp -q -v2 polyItemDispCheck2`;\
  1437.                      polyOptions -np -din $dv $de $df $dm; "
  1438.                 polyItemDispCheck2;
  1439.             
  1440.             floatSliderGrp -label "Normals Size" -field true
  1441.                 -min 0.02 -max 10 -precision 2
  1442.                 -changeCommand "polyOptions -newPolymesh -sizeNormal #1"
  1443.                 polyNormalSizeSlider;
  1444.  
  1445.             separator;
  1446.  
  1447.              checkBoxGrp -numberOfCheckBoxes 1
  1448.                  -label "Color"
  1449.                  -l1 "Colored Shading"
  1450.                  -cw 2 160
  1451.                  -on1 "polyOptions -np -cs 1;"
  1452.                  -of1 "polyOptions -np -cs 0;"
  1453.                  colorShadedDisplayCheck;
  1454.  
  1455.              optionMenuGrp -l "Color Material" 
  1456.                  -cc "prefPolyChangeMaterial"
  1457.                  colorMaterialPopup;
  1458.              menuItem -l "None" 
  1459.                  materialNoneMenuItem;
  1460.              menuItem -l "Ambient" 
  1461.                  materialAmbientMenuItem;
  1462.              menuItem -l "Ambient+Diffuse" 
  1463.                  materialAmbDiffMenuItem;
  1464.              menuItem -l "Diffuse" 
  1465.                  materialDiffuseMenuItem;
  1466.              menuItem -l "Specular" 
  1467.                  materialSpecularMenuItem;
  1468.              menuItem -l "Emission" 
  1469.                  materialEmissionMenuItem;
  1470.              setParent -m ..;
  1471.  
  1472.             separator;
  1473.  
  1474.             string $colorChannelStrings[] = {"none", "ambient", "ambientDiffuse",
  1475.                 "diffuse", "specular", "emission"};
  1476.             optionMenuGrp  -l "Backface Culling"
  1477.                 -cc "prefPolyChangeCulling"
  1478.                 polyFBackCullPopup;
  1479.                 menuItem -l "Off" backfaceOffMenuItem;
  1480.                 menuItem -l "On" backfaceOnMenuItem;
  1481.                 menuItem -l "Keep Wire" backfaceWireMenuItem;
  1482.                 menuItem -l "Keep Hard Edges" backfaceHardEdgeMenuItem;
  1483.                 setParent -m ..;
  1484.                 setParent ..;
  1485.             setParent ..;
  1486.  
  1487.     setParent $parent;
  1488.  
  1489.     setUITemplate -popTemplate;
  1490.  
  1491.     prefsUpdatePolys();
  1492. }
  1493.  
  1494.  
  1495. global proc prefsCreateManips() 
  1496. {
  1497.     global string $gPreferenceWindow;
  1498.     setParent $gPreferenceWindow;
  1499.     string $parent = "prefManipsCol";
  1500.     
  1501.     // Check to see if this has been created already.
  1502.     //
  1503.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1504.         return;
  1505.     }
  1506.  
  1507.     //  Create the UI
  1508.     //
  1509.     setParent $parent;
  1510.     setUITemplate -pushTemplate prefsTemplate;
  1511.  
  1512.     // This is used to force the width to fill the window
  1513.     separator -style "none" -h 1 -w 490;
  1514.  
  1515.     frameLayout -l "Manipulator Sizes";
  1516.         columnLayout -adj true;
  1517.  
  1518.             floatSliderGrp -field true
  1519.                 -label "Global Scale"
  1520.                 -min 0.1 -max 10 
  1521.                 -dc "manipOptions -s #1"
  1522.                 -cc "manipOptions -s #1"
  1523.                 -pre 2 -step 0.01 
  1524.                 manipScale;
  1525.  
  1526.             floatSliderGrp -field true
  1527.                 -label "Handle Size" 
  1528.                 -min 4 -max 100 
  1529.                 -dc "manipOptions -hs #1"
  1530.                 -cc "manipOptions -hs #1"
  1531.                 -pre 2 -step 0.5 
  1532.                 manipHS;
  1533.  
  1534.             intSliderGrp -field true
  1535.                 -label "Line Size" 
  1536.                 -min 1 -max 10 
  1537.                 -dc "manipOptions -ls #1"
  1538.                 -cc "manipOptions -ls #1"
  1539.                 -step 1 
  1540.                 manipLS;
  1541.  
  1542.             floatSliderGrp -field true
  1543.                 -label "Line Pick Size" 
  1544.                 -min 1 -max 15 
  1545.                 -cc "manipOptions -lp #1"
  1546.                 -pre 2 -step 1.0 
  1547.                 manipLP;
  1548.  
  1549.             floatSliderGrp -field true
  1550.                 -label "Previous State Size" 
  1551.                 -min 1 -max 10 
  1552.                 -cc "manipOptions -ps #1"
  1553.                 -pre 2 -step 0.01 
  1554.                 manipPS;
  1555.  
  1556.     setParent $parent;
  1557.  
  1558.     separator -style "none" -h 5;
  1559.  
  1560.     frameLayout -l "Show Manipulator";
  1561.         columnLayout -adj true;
  1562.  
  1563.             optionMenuGrp -l "Default Manipulator"
  1564.                 -cc "optionVar -iv defaultShowManipulator `optionMenuGrp -query -select defaultManipOpts`"
  1565.                 defaultManipOpts;
  1566.                 menuItem -label "None";
  1567.                 menuItem -label "Translate";
  1568.                 menuItem -label "Rotate";
  1569.                 menuItem -label "Scale";
  1570.                 menuItem -label "Transform";
  1571.                 menuItem -label "Smart";
  1572.  
  1573.     setParent $parent;
  1574.  
  1575.     setUITemplate -popTemplate;
  1576.  
  1577.     prefsUpdateManips();
  1578. }
  1579.  
  1580. global proc prefsCreateSettings() 
  1581. {
  1582.     global string $gPreferenceWindow;
  1583.     setParent $gPreferenceWindow;
  1584.     string $parent = "prefSettingsCol";
  1585.     
  1586.     // Check to see if this has been created already.
  1587.     //
  1588.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1589.         return;
  1590.     }
  1591.  
  1592.     //  Create the UI
  1593.     //
  1594.     setParent $parent;
  1595.     setUITemplate -pushTemplate prefsTemplate;
  1596.  
  1597.     // This is used to force the width to fill the window
  1598.     separator -style "none" -h 1 -w 490;
  1599.  
  1600.     frameLayout -l "World Coordinate System";
  1601.         columnLayout -adj true;
  1602.  
  1603.             radioButtonGrp -nrb 2
  1604.                 -l "Up Axis" 
  1605.                 -la2 "Y" "Z"
  1606.                 -on1 "setUpAxis \"y\""
  1607.                 -on2 "setUpAxis \"z\""
  1608.                 upAxisRBG;
  1609.  
  1610.     setParent $parent;
  1611.  
  1612.     separator -style "none" -h 5;
  1613.  
  1614.     frameLayout -l "Working Units";
  1615.         columnLayout -adj true;
  1616.  
  1617.             optionMenuGrp -l "Linear" 
  1618.                 -cc ("prefWndUnitsChanged \"linear\"")
  1619.                 linearOpts;
  1620.  
  1621.                 menuItem -l "millimeter";        // menu 1
  1622.                 menuItem -l "centimeter";        // menu 2
  1623.                 menuItem -l "meter";            // menu 3
  1624.                 // menuItem -l "kilometer";
  1625.                 menuItem -l "inch";                // menu 4
  1626.                 menuItem -l "foot";                // menu 5
  1627.                 menuItem -l "yard";                // menu 6
  1628.                 // menuItem -l "mile";
  1629.  
  1630.             separator -style "none" -h 5;
  1631.             separator -style "none" -h 5;
  1632.  
  1633.             optionMenuGrp -l "Angular"
  1634.                 -cc ("prefWndUnitsChanged \"angular\"")
  1635.                 angularOpts;
  1636.  
  1637.                 menuItem -l "degrees";
  1638.                 menuItem -l "radians";
  1639.  
  1640.             separator -style "none" -h 5;
  1641.             separator -style "none" -h 5;
  1642.  
  1643.             optionMenuGrp -l "Time"
  1644.                 -cc ("prefWndUnitsChanged \"time\"")
  1645.                 timeOpts;
  1646.  
  1647.                 menuItem -l "Game (15 fps)";
  1648.                 menuItem -l "Film (24 fps)";
  1649.                 menuItem -l "PAL (25 fps)";
  1650.                 menuItem -l "NTSC (30 fps)";
  1651.                 menuItem -l "Show (48 fps)";
  1652.                 menuItem -l "PAL Field (50 fps)";
  1653.                 menuItem -l "NTSC Field (60 fps)";
  1654.                 menuItem -l "milliseconds";
  1655.                 menuItem -l "seconds";
  1656.                 menuItem -l "minutes";
  1657.                 menuItem -l "hours";
  1658.             separator -style "none" -h 5;
  1659.             separator -style "none" -h 5;
  1660.  
  1661.             checkBoxGrp
  1662.                 -label ""
  1663.                 -label1 "Keep Keys at Current Frames"
  1664.                 -cw 2 240
  1665.                 updateKeys;
  1666.  
  1667.     setParent $parent;
  1668.  
  1669.     separator -style "none" -h 5;
  1670.  
  1671.     frameLayout -l "Tolerance";
  1672.         columnLayout -adj true;
  1673.  
  1674.             float $min = 0.0001;
  1675.             floatSliderGrp -field 1 -l "Positional" 
  1676.                 -min $min -max 0.1
  1677.                 -fmn $min -fmx 20.0
  1678.                 -cc "tolerance -l #1"
  1679.                 -pre 5 -step 0.05
  1680.                 posTolFloatSliderGrp;
  1681.  
  1682.             floatSliderGrp -field 1 -l "Tangential" 
  1683.                 -min $min -max 1.0
  1684.                 -fmn $min -fmx 20.0
  1685.                 -pre 5 -step 0.05
  1686.                 -cc "tolerance -a #1"
  1687.                 tanTolFloatSliderGrp;
  1688.  
  1689.     setParent $parent;
  1690.  
  1691.     setUITemplate -popTemplate;
  1692.  
  1693.     prefsUpdateSettings();
  1694. }
  1695.  
  1696.  
  1697. global proc prefsCreateAnim() 
  1698. {
  1699.     global string $gPreferenceWindow;
  1700.     global string $gPlayBackSlider;
  1701.  
  1702.     setParent $gPreferenceWindow;
  1703.     string $parent = "prefAnimCol";
  1704.     
  1705.     // Check to see if this has been created already.
  1706.     //
  1707.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1708.         return;
  1709.     }
  1710.  
  1711.     //  Create the UI
  1712.     //
  1713.     setParent $parent;
  1714.     setUITemplate -pushTemplate prefsTemplate;
  1715.  
  1716.     // This is used to force the width to fill the window
  1717.     separator -style "none" -h 1 -w 490;
  1718.  
  1719.     frameLayout -l "Timeline";
  1720.         columnLayout -adj true;
  1721.  
  1722.             // Changing the playback range can sometimes affect the start/end
  1723.             // range.  Update it in the callback.
  1724.             //
  1725.             floatFieldGrp
  1726.                 -l "Playback Start/End" 
  1727.                 -cal 1 "right"
  1728.                 -nf 2 
  1729.                 -pre 2
  1730.                 -cc ( "playbackOptions -e -min #1 -max #2; " +
  1731.                       "floatFieldGrp -e -v1 " +
  1732.                       "`playbackOptions -q -ast` -v2 " +
  1733.                       "`playbackOptions -q -aet` rangeSliderBounds; " +
  1734.                       "floatFieldGrp -e -v1 " +
  1735.                       "`playbackOptions -q -min` -v2 " +
  1736.                       "`playbackOptions -q -max` timeSliderBounds;" )
  1737.                 timeSliderBounds;
  1738.     
  1739.             // Changing the start/end range can sometimes affect the playback
  1740.             // range.  Update it in the callback.
  1741.             //
  1742.             floatFieldGrp
  1743.                 -l "Animation Start/End" 
  1744.                 -cal 1 "right"
  1745.                 -nf 2 
  1746.                 -pre 2
  1747.                 -cc ( "playbackOptions -e -ast #1 -aet #2; " +
  1748.                       "floatFieldGrp -e -v1 " +
  1749.                       "`playbackOptions -q -ast` -v2 " +
  1750.                       "`playbackOptions -q -aet` rangeSliderBounds; " +
  1751.                       "floatFieldGrp -e -v1 " +
  1752.                       "`playbackOptions -q -min` -v2 " +
  1753.                       "`playbackOptions -q -max` timeSliderBounds;" )
  1754.                 rangeSliderBounds;
  1755.  
  1756.             separator -style "none" -h 5;
  1757.             radioButtonGrp -nrb 3
  1758.                 -l "Height"
  1759.                 -cw 2 100 -cw 3 100
  1760.                 -la3 "1x" "2x" "4x"
  1761.                 -on1 "timeControl -e -h 28 $gPlayBackSlider"
  1762.                 -on2 "timeControl -e -h 56 $gPlayBackSlider"
  1763.                 -on3 "timeControl -e -h 112 $gPlayBackSlider"
  1764.                 timeLineSize;
  1765.  
  1766.             radioButtonGrp -l "Key Ticks" -nrb 3
  1767.                 -cw 2 100 -cw 3 100
  1768.                 -la3 "None" "Active" "Channel Box"
  1769.                 -on1 "timeControl -e -showKeys none $gPlayBackSlider"
  1770.                 -on2 "timeControl -e -showKeys active $gPlayBackSlider"
  1771.                 -on3 "timeControl -e -showKeys $gChannelBoxName $gPlayBackSlider"
  1772.                 showTicks;
  1773.  
  1774.             checkBoxGrp -l "Options" -ncb 2
  1775.                 -cw 2 100
  1776.                 -la2 "Timecode" "Snapping" 
  1777.                 -cc1 ("animDisplay -e -tc #1; prefAnimTimeCodeChanged")
  1778.                 -cc2 "timeControl -e -snap #1 $gPlayBackSlider;"
  1779.                 timeLine;
  1780.  
  1781.             textFieldGrp 
  1782.                 -label "Timecode Offset"
  1783.                 -columnWidth 2 125
  1784.                 -text `animDisplay -q -timeCodeOffset`
  1785.                 -enable `animDisplay -q -timeCode`
  1786.                 -changeCommand ("animDisplay -timeCodeOffset " + "\"#1\"; " +
  1787.                                 "textFieldGrp -e -text `animDisplay -q -tco` "+
  1788.                                 "timeCodeOffset")
  1789.                 timeCodeOffset;
  1790.  
  1791.     setParent $parent;
  1792.  
  1793.     separator -style "none" -h 5;
  1794.  
  1795.     frameLayout -l "Playback";
  1796.         columnLayout -adj true;
  1797.  
  1798.             radioButtonGrp  -nrb 2
  1799.                 -l "Update View"
  1800.                 -cw 2 100 -cw 3 100
  1801.                 -la2 "Active" "All" 
  1802.                 -on1 "playbackOptions -v \"active\""
  1803.                 -on2 "playbackOptions -v \"all\""
  1804.                 playbackView;
  1805.  
  1806.             radioButtonGrp -nrb 3
  1807.                 -l "Looping"
  1808.                 -cw 2 100 -cw 3 100
  1809.                 -la3 "Once" "Oscillate" "Continuous"
  1810.                 -on1 "playbackOptions -l \"once\""
  1811.                 -on2 "playbackOptions -l \"oscillate\""
  1812.                 -on3 "playbackOptions -l \"continuous\""
  1813.                 playbackLooping;
  1814.  
  1815.             rowLayout -nc 4
  1816.                 -cw4 135 150 65 90
  1817.                 -cal 1 "right"
  1818.                 -cal 3 "right"
  1819.                 -cat 1 "both" 5
  1820.                 -cat 3 "both" 5
  1821.                 playbackRow;
  1822.  
  1823.                 text -l "Playback Speed";
  1824.                 optionMenu -l "" 
  1825.                     -cc ("prefWndAnimOptionChanged 1")
  1826.                     speedOpts;
  1827.  
  1828.                     // Create the menu items.  Dynamically determine
  1829.                     // the labels on them later, with a call to prefWndAnimOptionChanged.
  1830.                     //
  1831.                     menuItem playbackSpeedFree;
  1832.                     menuItem playbackSpeedNormal;
  1833.                     menuItem playbackSpeedHalf;
  1834.                     menuItem playbackSpeedTwice;
  1835.                     menuItem playbackSpeedOther;
  1836.  
  1837.                 text -enable 0 -label "Other" playbackSpeedT;
  1838.  
  1839.                 // The initial value of this field determines the 
  1840.                 // "fps" label on the "Other" menu entry, the
  1841.                 // first time it's shown.  
  1842.                 //
  1843.                 floatField -enable 0
  1844.                     -value 0
  1845.                     -minValue 0.0
  1846.                     -precision 2
  1847.                     -cc ("prefWndAnimOptionChanged 1")
  1848.                     playbackSpeedFF;
  1849.             setParent ..;
  1850.  
  1851.             rowLayout -nc 2
  1852.                 -cw2 135 90
  1853.                 -cal 1 "right"
  1854.                 -cat 1 "both" 5
  1855.                 playbackByRow;
  1856.  
  1857.                 text -l "Playback by";
  1858.  
  1859.                 // Sometimes we don't get the -by rate we've requested.
  1860.                 // Update it after the command's executed so we show the
  1861.                 // resulting value.
  1862.                 //
  1863.                 floatField
  1864.                         -value 1
  1865.                         -minValue 0.001
  1866.                         -precision 3
  1867.                         -cc ( "playbackOptions -by #1; " +
  1868.                               "floatField -e -value " +
  1869.                               "`playbackOptions -q -by` playbackByFF" )
  1870.                         playbackByFF;
  1871.  
  1872.     setParent $parent;
  1873.  
  1874.     setUITemplate -popTemplate;
  1875.  
  1876.     // Update the playback speed menu item labels created above.
  1877.     //
  1878.     prefWndAnimOptionChanged 0;
  1879.  
  1880.     // If the window's up when someone else has changed the current time unit,
  1881.     // we should update.
  1882.     //
  1883.     scriptJob -protected -parent $parent -event timeUnitChanged "prefWndAnimOptionChanged 1";
  1884.  
  1885.     prefsUpdateAnim();
  1886. }
  1887.  
  1888.  
  1889. global proc prefsCreateModeling() 
  1890. {
  1891.     global string $gPreferenceWindow;
  1892.     setParent $gPreferenceWindow;
  1893.     string $parent = "prefModelingCol";
  1894.     
  1895.     // Check to see if this has been created already.
  1896.     //
  1897.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1898.         return;
  1899.     }
  1900.  
  1901.     //  Create the UI
  1902.     //
  1903.     setParent $parent;
  1904.     setUITemplate -pushTemplate prefsTemplate;
  1905.  
  1906.     // This is used to force the width to fill the window
  1907.     separator -style "none" -h 1 -w 490;
  1908.  
  1909.     frameLayout -l "Output Geometry Type";
  1910.         columnLayout -adj true;
  1911.  
  1912.         if( `isTrue "SurfaceUIExists"` ) {
  1913.  
  1914.             radioButtonGrp -numberOfRadioButtons 1
  1915.                 -label "Output Geometry as"
  1916.                 -l1 "NURBS" 
  1917.                 -on1 "prefsChangeOutputType 0"
  1918.                 modelWithType1;
  1919.             radioButtonGrp -numberOfRadioButtons 1
  1920.                 -scl modelWithType1
  1921.                 -label " "
  1922.                 -l1 "Polygons" 
  1923.                 -on1 "prefsChangeOutputType 1"
  1924.                 modelWithType2;
  1925.             radioButtonGrp -numberOfRadioButtons 1
  1926.                 -scl modelWithType1
  1927.                 -label " "
  1928.                 -l1 "Beziers" 
  1929.                 -on1 "prefsChangeOutputType 3"
  1930.                 modelWithType3;
  1931.  
  1932.             if( `licenseCheck -m "edit" -typ "model"` ) {
  1933.                 radioButtonGrp -numberOfRadioButtons 1
  1934.                     -scl modelWithType1
  1935.                     -label " "
  1936.                     -l1 "Subdiv Surfaces" 
  1937.                     -on1 "prefsChangeOutputType 2"
  1938.                     -cw 2 300
  1939.                     modelWithType4;
  1940.             }
  1941.  
  1942.             radioButtonGrp -numberOfRadioButtons 1
  1943.                 -scl modelWithType1
  1944.                 -label " "
  1945.                 -l1 "Mixed (Set by individual Option Boxes in menus)" 
  1946.                 -on1 "prefsUpdateModeling; error \"Set specific types using Option Boxes\";"
  1947.                 -cw 2 300
  1948.                 modelWithType5;
  1949.     }
  1950.  
  1951.     setParent $parent;
  1952.  
  1953.     separator -style "none" -h 5;
  1954.  
  1955.     frameLayout -l "NURBS Interaction";
  1956.         columnLayout -adj true;
  1957.  
  1958.             radioButtonGrp -numberOfRadioButtons 1
  1959.                 -label "Interaction Mode"
  1960.                 -l1 "Everything is a Tool" 
  1961.                 -on1 "prefsChangeToolType 1"
  1962.                 -cw 2 300
  1963.                 modelWithTools1;
  1964.             radioButtonGrp -numberOfRadioButtons 1
  1965.                 -scl modelWithTools1
  1966.                 -label " "
  1967.                 -l1 "Everything is an Action" 
  1968.                 -on1 "prefsChangeToolType 0"
  1969.                 -cw 2 300
  1970.                 modelWithTools2;
  1971.             radioButtonGrp -numberOfRadioButtons 1
  1972.                 -scl modelWithTools1
  1973.                 -label " "
  1974.                 -l1 "Mixed (Set by individual Option Boxes in menus)" 
  1975.                 -on1 "prefsUpdateModeling; error \"Set specific types using Option Boxes\";"
  1976.                 -cw 2 300
  1977.                 modelWithTools3;
  1978.  
  1979.     setParent $parent;
  1980.  
  1981.     setUITemplate -popTemplate;
  1982.  
  1983.     prefsUpdateModeling();
  1984. }
  1985.  
  1986.  
  1987. global proc prefsCreateKeys() 
  1988. {
  1989.     global string $gPreferenceWindow;
  1990.     global string $gPlayBackSlider;
  1991.  
  1992.     setParent $gPreferenceWindow;
  1993.     string $parent = "prefKeysCol";
  1994.     
  1995.     // Check to see if this has been created already.
  1996.     //
  1997.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  1998.         return;
  1999.     }
  2000.  
  2001.     //  Create the UI
  2002.     //
  2003.     setParent $parent;
  2004.     setUITemplate -pushTemplate prefsTemplate;
  2005.  
  2006.     // This is used to force the width to fill the window
  2007.     separator -style "none" -h 1 -w 490;
  2008.  
  2009.     frameLayout -l "Auto Key";
  2010.         columnLayout -adj true;
  2011.  
  2012.             checkBoxGrp  -ncb 1
  2013.                 -l ""
  2014.                 -l1 "Auto Key"
  2015.                 -cc1 "autoKeyframe -state #1; optionMenuGrp -e -en #1 autoKeyCharacter"
  2016.                 autoKey;
  2017.  
  2018.             optionMenuGrp -label "On Character Sets"
  2019.                 -cc "prefAutoKeyCharacterChanged"
  2020.                 autoKeyCharacter;
  2021.                 menuItem -label "Key Modified Attributes" stardardCharAuto;
  2022.                 menuItem -label "Key All Attributes" allCharAuto;
  2023.     setParent $parent;
  2024.  
  2025.     frameLayout -l "Rotation Interpolation";
  2026.         columnLayout -adj true;
  2027.  
  2028.             optionMenuGrp -label "New Curve Default"
  2029.                 -cc "optionVar -iv rotationInterpolationDefault `optionMenuGrp -query -select rotationInterpolationDefaultOptions`"
  2030.                 rotationInterpolationDefaultOptions;
  2031.                 menuItem -label "Independent Euler-Angle Curves" rotationInterpolationDefaultNone;
  2032.                 menuItem -label "Synchronized Euler-Angle Curves" rotationInterpolationDefaultEuler;
  2033.                 menuItem -label "Synchronized Quaternion Curves" rotationInterpolationDefaultQuaternion;
  2034.  
  2035.     setParent $parent;
  2036.  
  2037.     frameLayout -l "Tangents";
  2038.         columnLayout -adj true;
  2039.  
  2040.             checkBoxGrp  -ncb 1 -cw 2 200
  2041.                 -l ""
  2042.                 -l1 "Weighted Tangents"
  2043.                 -cc1 "keyTangent -edit -global -weightedTangents #1"
  2044.                 weightedTangents;
  2045.  
  2046.             optionMenuGrp -label "Default In Tangent" 
  2047.                 -cc "prefAnimTangentsChanged 1"
  2048.                 inTangentType;
  2049.                 menuItem -label "Spline" splineItt;
  2050.                 menuItem -label "Linear" linearItt;
  2051.                 menuItem -label "Clamped" ClampedItt;
  2052.                 menuItem -label "Flat" flatItt;
  2053.                 
  2054.             optionMenuGrp -label "Default Out Tangent" 
  2055.                 -cc "prefAnimTangentsChanged 0"
  2056.                 outTangentType;
  2057.                 menuItem -label "Spline" splineOtt;
  2058.                 menuItem -label "Linear" linearOtt;
  2059.                 menuItem -label "Clamped" ClampedOtt;
  2060.                 menuItem -label "Flat" flatOtt;
  2061.                 menuItem -label "Stepped" steppedOtt;
  2062.  
  2063.     setParent $parent;
  2064.  
  2065.     setUITemplate -popTemplate;
  2066.  
  2067.     prefsUpdateKeys();
  2068. }
  2069.  
  2070. global proc prefsCreateSelect() 
  2071. {
  2072.     global string $gSelItems[];
  2073.     global string $gPreferenceWindow;
  2074.     setParent $gPreferenceWindow;
  2075.     string $parent = "prefSelectCol";
  2076.     
  2077.     // Check to see if this has been created already.
  2078.     //
  2079.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2080.         return;
  2081.     }
  2082.  
  2083.     //  Create the UI
  2084.     //
  2085.     setParent $parent;
  2086.     setUITemplate -pushTemplate prefsTemplate;
  2087.  
  2088.     // This is used to force the width to fill the window
  2089.     separator -style "none" -h 1 -w 490;
  2090.  
  2091.     frameLayout -l "Modifiers";
  2092.         columnLayout -adj true;
  2093.  
  2094.             checkBoxGrp -ncb 2
  2095.                 -l "" 
  2096.                 -la2 "Single Marquee Select" "Click Drag Select"
  2097.                 -cc1 "selectPref -singleBoxSelection #1"
  2098.                 -cc2 "selectPref -clickDrag #1"
  2099.                 -cw3 20 180 160
  2100.                 modsCBG1;
  2101.  
  2102.             checkBoxGrp -ncb 2
  2103.                 -l "" 
  2104.                 -la2 "Affects Active" "Popup Menu Selection"
  2105.                 -cc1 "selectPref -affectsActive #1"
  2106.                 -cc2 "selectPref -popupMenuSelection #1"
  2107.                 -cw3 20 180 160
  2108.                 modsCBG2;
  2109.  
  2110.             checkBoxGrp -ncb 2
  2111.                 -l ""
  2112.                 -la2 "Ignore Selection Priority" "Expand Popup List"
  2113.                 -cc1 "selectPref -ignoreSelectionPriority #1"
  2114.                 -cc2 "selectPref -expandPopupList #1"
  2115.                 -cw3 20 180 160
  2116.                 modsCBG3;
  2117.  
  2118.             intSliderGrp -field true
  2119.                 -label "Click Box Size"
  2120.                 -min 0 -max 100  -fmx 100
  2121.                 -cc "selectPref -clickBoxSize #1"
  2122.                 -cw 1 118
  2123.                 clickBoxSizeS;
  2124.  
  2125.     setParent $parent;
  2126.  
  2127.     if (`isTrue "PolygonsExists"`) {
  2128.         separator -style "none" -h 5;
  2129.  
  2130.         frameLayout -l "Polygon Selection";
  2131.             columnLayout -adj true;
  2132.  
  2133.             radioButtonGrp -numberOfRadioButtons 2
  2134.                 -label "Select Faces with"
  2135.                 -l1 "Center" -l2 "Whole Face"
  2136.                 -on1 "polySelectConstraint -wholeSensitive off"
  2137.                 -on2 "polySelectConstraint -wholeSensitive on"
  2138.                 polyFaceSensitiveRadio;
  2139.  
  2140.         setParent $parent;
  2141.     }
  2142.  
  2143.     separator -style "none" -h 5;
  2144.  
  2145.     frameLayout -l "Priority";
  2146.  
  2147.         formLayout priorForm;
  2148.             textScrollList 
  2149.                 -h 130 -w 180
  2150.                 -ams true
  2151.                 -sc "prefSelectPriorListChanged"
  2152.                 priorList;
  2153.  
  2154.             // Add the selection priority items to the list in alphabetical order
  2155.             //
  2156.             int $i;
  2157.             string $sortedSelItems[] = `sort $gSelItems`;
  2158.  
  2159.             for ($i = 0; $i < size($sortedSelItems); $i++) {
  2160.                 // Don't add fluids to the UI if we don't
  2161.                 // have the right license.
  2162.                 // 
  2163.                 // The "fluid" entry, however, should still
  2164.                 // be part of $gSelItems to maintain the
  2165.                 // correct relationships between optionVars
  2166.                 // and related priority settings when users
  2167.                 // switch b/w apps w/ different licenses.
  2168.                 // 
  2169.                 // Since the UI is alphabetically sorted
  2170.                 // anyway, any selections here do name
  2171.                 // lookups based on the currently selected
  2172.                 // item in the scrollList so we don't have
  2173.                 // to worry about indices getting out of
  2174.                 // sync (since $sortedSelItems will have one
  2175.                 // less item than $gSelItems).
  2176.                 //
  2177.                 if(( $sortedSelItems[$i] == "fluid" )
  2178.                 && ! fluidEditLicenseFound() )     
  2179.                 {
  2180.                     continue;
  2181.                 }
  2182.  
  2183.                 textScrollList -e -a $sortedSelItems[$i] priorList;
  2184.             }
  2185.  
  2186.             textScrollList -e -sii 1 priorList;
  2187.  
  2188.             optionMenu 
  2189.                 -l "Presets" 
  2190.                 -cc "prefSelectPriorModeChanged"
  2191.                 presetOpts;
  2192.                 
  2193.                 menuItem -l "Custom";
  2194.                 menuItem -l "Animation";
  2195.                 menuItem -l "NURBS";
  2196.                 menuItem -l "Rendering";
  2197.                 menuItem -l "Dynamics";
  2198.  
  2199.             intFieldGrp
  2200.                 -l "Priority"
  2201.                 -cw 1 55 
  2202.                 -cc "prefSelectPriorValChanged"
  2203.                 priorVal;
  2204.  
  2205.         setParent ..;
  2206.         formLayout -e 
  2207.             -af priorList "left" 10
  2208.             -af priorList "top" 0
  2209.             -af presetOpts "top" 0
  2210.             -ac presetOpts "left" 20 priorList
  2211.             -ac priorVal "top" 75 presetOpts
  2212.             -ac priorVal "left" 20 priorList
  2213.             priorForm;
  2214.  
  2215.     setParent $parent;
  2216.  
  2217.     setUITemplate -popTemplate;
  2218.  
  2219.     prefsUpdateSelect();
  2220. }
  2221.  
  2222.  
  2223. global proc prefsCreateSnap() 
  2224. {
  2225.     global string $gPreferenceWindow;
  2226.     setParent $gPreferenceWindow;
  2227.     string $parent = "prefSnapCol";
  2228.     
  2229.     // Check to see if this has been created already.
  2230.     //
  2231.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2232.         return;
  2233.     }
  2234.  
  2235.     //  Create the UI
  2236.     //
  2237.     setParent $parent;
  2238.     setUITemplate -pushTemplate prefsTemplate;
  2239.  
  2240.     // This is used to force the width to fill the window
  2241.     separator -style "none" -h 1 -w 490;
  2242.  
  2243.     frameLayout -l "Snapping"; 
  2244.         columnLayout -adj true;
  2245.  
  2246.             checkBoxGrp -ncb 1
  2247.                 -l ""
  2248.                 -l1 "Use Snap Tolerance"
  2249.                 -cc1 "snapMode -useTolerance #1"
  2250.                 -cw 2 240
  2251.                 useSnapCBG1;
  2252.  
  2253.             intSliderGrp -field true
  2254.                     -label "Snap Tolerance"
  2255.                     -min 0 -max 100  -fmx 100
  2256.                     -cc "snapMode -tolerance #1"
  2257.                     snapToleranceSG;
  2258.  
  2259.     setParent $parent;
  2260.  
  2261.     frameLayout -l "UV Texture Editor Snapping"; 
  2262.         columnLayout -adj true;
  2263.             intSliderGrp -field true
  2264.                     -label "UV Snap Tolerance"
  2265.                     -min 0 -max 100  -fmx 100
  2266.                     -cc "snapMode -uvTolerance #1"
  2267.                     snapUVToleranceSG;
  2268.  
  2269.     setParent $parent;
  2270.  
  2271.     frameLayout -l "Edge Snapping"; 
  2272.         columnLayout -adj true;
  2273.  
  2274.             intSliderGrp -field true
  2275.                     -label "Snap Magnets"
  2276.                     -min 0 -max 10  -fmx 100
  2277.                     -cc "snapMode -edgeMagnet #1"
  2278.                     snapMagnetSG;
  2279.  
  2280.             floatSliderGrp -field true
  2281.                     -label "Magnet Tolerance"
  2282.                     -min 0.0 -max 10.0  -fmx 100.0
  2283.                     -cc "snapMode -edgeMagnetTolerance #1"
  2284.                     snapMagnetToleranceSG;
  2285.  
  2286.     setParent $parent;
  2287.  
  2288.     setUITemplate -popTemplate;
  2289.  
  2290.     prefsUpdateSnap();
  2291. }
  2292.  
  2293.  
  2294. global proc prefsCreateSound() 
  2295. {
  2296.     global string $gPreferenceWindow;
  2297.     global string $gPlayBackSlider;
  2298.  
  2299.     setParent $gPreferenceWindow;
  2300.     string $parent = "prefSoundCol";
  2301.     
  2302.     // Check to see if this has been created already.
  2303.     //
  2304.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2305.         return;
  2306.     }
  2307.  
  2308.     //  Create the UI
  2309.     //
  2310.     setParent $parent;
  2311.     setUITemplate -pushTemplate prefsTemplate;
  2312.  
  2313.     // This is used to force the width to fill the window
  2314.     separator -style "none" -h 1 -w 490;
  2315.  
  2316.     frameLayout -l "Sound";
  2317.         columnLayout -adj true;
  2318.  
  2319.             radioButtonGrp  -nrb 3
  2320.                 -l "Waveform Display"
  2321.                 -cw 2 100 -cw 3 100
  2322.                 -la3 "Top" "Bottom" "All"
  2323.                 -on1 "timeControl -e -waveform top $gPlayBackSlider"
  2324.                 -on2 "timeControl -e -waveform bottom $gPlayBackSlider"
  2325.                 -on3 "timeControl -e -waveform both $gPlayBackSlider"
  2326.                 soundDisplay;
  2327.  
  2328.             checkBoxGrp -l "Repeat on Hold" 
  2329.                 -ncb 1 -l1 ""
  2330.                 -cc1 ( "rowLayout -e -enable #1 soundRepeatChunkLayout;" +
  2331.                        "timeControl -e -repeatOnHold #1 $gPlayBackSlider;" )
  2332.                 soundRepeat;
  2333.  
  2334.             rowLayout -nc 6
  2335.                 -cw6 135 100 100 100 10 10
  2336.                 -cal 1 "right"
  2337.                 -cal 2 "left"
  2338.                 -cal 3 "left"
  2339.                 -cal 4 "left"
  2340.                 -cat 1 "both" 5
  2341.                 -cat 2 "left" 5
  2342.                 -cat 3 "left" 5
  2343.                 -cat 4 "left" 5
  2344.                 soundRepeatChunkLayout;
  2345.  
  2346.                 text -l "Repeat Size";
  2347.                 radioCollection soundRepeatChunkCollection;
  2348.                 radioButton -l "1" 
  2349.                     -onc "timeControl -e -repeatChunkSize 1 $gPlayBackSlider"
  2350.                     soundRepeatChunk1;
  2351.                 radioButton -l "2" 
  2352.                     -onc "timeControl -e -repeatChunkSize 2 $gPlayBackSlider"
  2353.                     soundRepeatChunk2;
  2354.                 radioButton -l "3" 
  2355.                     -onc "timeControl -e -repeatChunkSize 3 $gPlayBackSlider"
  2356.                     soundRepeatChunk3;
  2357.  
  2358.                 // This is the radio button that gets set
  2359.                 // when the timeControl's repeat chunk size
  2360.                 // isn't 1, 2, or 3.  It's invisible, so we
  2361.                 // can get around the fact that one radio
  2362.                 // button in a collection MUST always be
  2363.                 // selected.
  2364.                 //
  2365.                 radioButton -l "4" -visible false soundRepeatChunk4;
  2366.                 floatField -visible false soundRepeatChunkValue;
  2367.  
  2368.     setParent $parent;
  2369.  
  2370.     setUITemplate -popTemplate;
  2371.  
  2372.     prefsUpdateSound();
  2373. }
  2374.  
  2375. global proc prefsCreateKin() 
  2376. {
  2377.     global string $gPreferenceWindow;
  2378.     setParent $gPreferenceWindow;
  2379.     string $parent = "prefKinCol";
  2380.     
  2381.     // Check to see if this has been created already.
  2382.     //
  2383.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2384.         return;
  2385.     }
  2386.  
  2387.     //  Create the UI
  2388.     //
  2389.     setParent $parent;
  2390.     setUITemplate -pushTemplate prefsTemplate;
  2391.  
  2392.     // This is used to force the width to fill the window
  2393.     separator -style "none" -h 1 -w 490;
  2394.  
  2395.     frameLayout -l "Inverse Kinematics";
  2396.         columnLayout -adj true;
  2397.  
  2398.             floatSliderGrp
  2399.                 -l "Joint Size"
  2400.                 -field 1
  2401.                 -min 0.01
  2402.                 -max 5.0
  2403.                 -pre 2
  2404.                 -dc "jointDisplayScale #1"
  2405.                 -cc "jointDisplayScale #1"
  2406.                 jdsPrefWidget;
  2407.                      
  2408.             floatSliderGrp
  2409.                 -l "Ik/Fk Joint Size"
  2410.                 -field 1
  2411.                 -min 0.01
  2412.                 -max 5.0
  2413.                 -pre 2
  2414.                 -dc "jointDisplayScale -ikfk #1"
  2415.                 -cc "jointDisplayScale -ikfk #1"
  2416.                 jdsIkFkPrefWidget;
  2417.                      
  2418.             floatSliderGrp
  2419.                 -l "IK Handle Size"
  2420.                 -field 1
  2421.                 -min 0.01
  2422.                 -max 5.0
  2423.                 -pre 2
  2424.                 -dc "ikHandleDisplayScale #1"
  2425.                 -cc "ikHandleDisplayScale #1"
  2426.                 hdsPrefWidget;
  2427.  
  2428.             radioButtonGrp -nrb 4
  2429.                 -l "Ik/Fk Blending Display"
  2430.                 -cw 2 68 -cw 3 68 -cw 4 68 -cw 5 68
  2431.                 -la4 "None" "Ik" "Fk" "Both"
  2432.                 -on1 "ikfkDisplayMethod -display none"
  2433.                 -on2 "ikfkDisplayMethod -display ik"
  2434.                 -on3 "ikfkDisplayMethod -display fk"
  2435.                 -on4 "ikfkDisplayMethod -display ikfk"
  2436.                 ikfkDisplay;
  2437.  
  2438.     setParent $parent;
  2439.  
  2440.     setUITemplate -popTemplate;
  2441.  
  2442.     prefsUpdateKin();
  2443. }
  2444.  
  2445. global proc prefsCreateAnimDisplay() 
  2446. {
  2447.     global string $gPreferenceWindow;
  2448.     setParent $gPreferenceWindow;
  2449.     string $parent = "prefAnimDispCol";
  2450.     
  2451.     // Check to see if this has been created already.
  2452.     //
  2453.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2454.         return;
  2455.     }
  2456.  
  2457.     //  Create the UI
  2458.     //
  2459.     setParent $parent;
  2460.     setUITemplate -pushTemplate prefsTemplate;
  2461.  
  2462.     // This is used to force the width to fill the window
  2463.     separator -style "none" -h 1 -w 490;
  2464.  
  2465.     frameLayout -l "Ghosts";
  2466.         columnLayout -adj true;
  2467.             intSliderGrp -field true
  2468.                 -cw3 175 75 150
  2469.                 -label "Steps before Current Frame"
  2470.                 -annotation "Number of ghosts drawn at times less than the current time"
  2471.                 -min 0 -max 10 -fmx 100
  2472.             -cc "updateGhostData 0 #1"
  2473.                 ghostFramesBeforeSlider;
  2474.             intSliderGrp -field true
  2475.                 -cw3 175 75 150
  2476.                 -label "Steps after Current Frame"
  2477.                 -annotation "Number of ghosts drawn at times greater than the current time"
  2478.                 -min 0 -max 10 -fmx 100
  2479.             -cc "updateGhostData 1 #1"
  2480.                 ghostFramesAfterSlider;
  2481.             intSliderGrp -field true
  2482.                 -cw3 175 75 150
  2483.                 -label "Frames Per Step"
  2484.                 -annotation "Time increment between ghosts"
  2485.                 -min 1 -max 10 -fmx 100
  2486.             -cc "updateGhostData 2 #1"
  2487.                 ghostFrameStepSlider;
  2488.  
  2489.     setParent $parent;
  2490.  
  2491.     setUITemplate -popTemplate;
  2492.  
  2493.     prefsUpdateAnimDisplay();
  2494. }
  2495.  
  2496. global proc prefsCreateDyn() 
  2497. //
  2498. // Description:
  2499. //   Creates the preference controls for Dynamics.
  2500. //        dynPrefAutoCreate determines whether rigid bodies are automatically
  2501. //         created when a user tries to connect a field to a geometry object.
  2502. //        dynPrefRunupToCurrentTime determines whether the dynamics system
  2503. //           is run up to the new current time position when the user sets the
  2504. //           time slider forward.
  2505. //        dynPrefRunupFrom determines whether the dynamics system
  2506. //           is run up from previous or current time position when the user
  2507. //           sets the time slider forward.
  2508. //        dynPrefSaveRuntimeState determines whether the runtime state
  2509. //         of particle objects, as well as the initial state, gets saved
  2510. //         to file.
  2511. //
  2512. //    Note that we are dealing with pref values in 3 different places:
  2513. //        The UI controls, which have the current value of the preference
  2514. //        The "current pref", also the current value, which is saved in the TdynStatic
  2515. //        class, and is queried and edited by the "dynPref" action.
  2516. //        The "saved pref", which is saved in the optionVar and is the value which will
  2517. //        be saved to file when maya is quit.
  2518. //
  2519. {
  2520.     global string $gPreferenceWindow;
  2521.     setParent $gPreferenceWindow;
  2522.     string $parent = "prefDynCol";
  2523.     
  2524.     // Check to see if this has been created already.
  2525.     //
  2526.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2527.         return;
  2528.     }
  2529.  
  2530.     //  Create the UI
  2531.     //
  2532.     setParent $parent;
  2533.     setUITemplate -pushTemplate prefsTemplate;
  2534.  
  2535.     // If the Dynamics modules isn't loaded, disable everything
  2536.     int $enable = `isTrue "DynamicsExists"`;
  2537.  
  2538.     // This is used to force the width to fill the window
  2539.     separator -style "none" -h 1 -w 490;
  2540.  
  2541.     frameLayout -l "Dynamics";
  2542.         columnLayout -adj true;
  2543.  
  2544.         checkBoxGrp -ncb 1
  2545.             -l "" 
  2546.             -cw 2 200
  2547.             -l1 "Auto Create Rigid Body"
  2548.             -on1 "dynPref -ac 1"
  2549.             -of1 "dynPref -ac 0"
  2550.             -enable $enable
  2551.             dynAutoCreate;
  2552.  
  2553.         checkBoxGrp -ncb 1
  2554.             -l "" 
  2555.             -cw 2 200
  2556.             -l1 "Run Up to Current Time"
  2557.             -on1 "dynPrefSetRunup 1"
  2558.             -of1 "dynPrefSetRunup 0"
  2559.             -enable $enable
  2560.             dynRunupToCurrentTime;
  2561.  
  2562.         radioButtonGrp -l "Run Up From" -nrb 2
  2563.             -la2 "Previous Time" "Start Time"
  2564.             -on1 "dynPref -rf  1"
  2565.             -on2 "dynPref -rf  2"
  2566.             -enable $enable
  2567.             dynRunupFrom;
  2568.  
  2569.         checkBoxGrp -ncb 1
  2570.             -l "" 
  2571.             -cw 2 250
  2572.             -l1 "Save Startup Cache for Particles"
  2573.             -on1 "dynPref -sr 1"
  2574.             -of1 "dynPref -sr 0"
  2575.             -enable $enable
  2576.             dynSaveRuntimeState;
  2577.  
  2578.     setParent $parent;
  2579.  
  2580.     setUITemplate -popTemplate;
  2581.  
  2582.     prefsUpdateDyn();
  2583. }
  2584.  
  2585. global proc prefsCreateAdvanced() 
  2586. {
  2587.     global string $gPreferenceWindow;
  2588.     setParent $gPreferenceWindow;
  2589.     string $parent = "prefAdvancedCol";
  2590.     
  2591.     // Check to see if this has been created already.
  2592.     //
  2593.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2594.         return;
  2595.     }
  2596.  
  2597.     //  Create the UI
  2598.     //
  2599.     setParent $parent;
  2600.     setUITemplate -pushTemplate prefsTemplate;
  2601.  
  2602.     // This is used to force the width to fill the window
  2603.     separator -style "none" -h 1 -w 490;
  2604.  
  2605.     frameLayout -l "Undo";
  2606.         columnLayout -adj true;
  2607.  
  2608.             radioButtonGrp -nrb 2
  2609.                 -l "Undo" 
  2610.                 -la2 "On" "Off"
  2611.                 -on1 "undoInfo -state on"
  2612.                 -on2 "undoInfo -state off"
  2613.                 undoEnableRBG;
  2614.  
  2615.             radioButtonGrp -nrb 2
  2616.                 -l "Queue" 
  2617.                 -la2 "Infinite" "Finite"
  2618.                 -on1 ("undoInfo -infinity on; intFieldGrp -e -enable false queueSizeIFG")
  2619.                 -on2 ("undoInfo -infinity off; intFieldGrp -e -enable true queueSizeIFG")
  2620.                 queueLimitRBG;
  2621.  
  2622.             intFieldGrp
  2623.                 -l "Queue Size"
  2624.                 -cc "undoInfo -length #1"
  2625.                 queueSizeIFG;
  2626.  
  2627.     setParent $parent;
  2628.  
  2629.     setUITemplate -popTemplate;
  2630.  
  2631.     prefsUpdateAdvanced();
  2632. }
  2633.  
  2634.  
  2635. global proc prefsCreateRendering() 
  2636. {
  2637.     global string $gPreferenceWindow;
  2638.     setParent $gPreferenceWindow;
  2639.     string $parent = "prefRenderingCol";
  2640.     
  2641.     // Check to see if this has been created already.
  2642.     //
  2643.     if (`columnLayout -query -numberOfChildren $parent` > 0) {
  2644.         return;
  2645.     }
  2646.  
  2647.     //  Create the UI
  2648.     //
  2649.     setParent $parent;
  2650.     setUITemplate -pushTemplate prefsTemplate;
  2651.  
  2652.     // This is used to force the width to fill the window
  2653.     separator -style "none" -height 1 -width 490;
  2654.  
  2655.     frameLayout -l "Rendering";
  2656.         columnLayout -adjustableColumn true;
  2657.  
  2658.         // Renderer selection option menu
  2659.         
  2660.         string $renderers[] = `renderer -query -namesOfAvailableRenderers`; 
  2661.         string $rendererUIName = "";
  2662.  
  2663.         optionMenu
  2664.                 -label "Preferred Renderer"
  2665.                 -annotation "Select Preferred Renderer" 
  2666.                 -changeCommand updatePreferredRendererSel prefRendererOptionMenu;
  2667.  
  2668.         for ($i = 0; $i < size($renderers); $i += 1)
  2669.         {
  2670.             $rendererUIName = `renderer -query -rendererUIName $renderers[$i]`;
  2671.             menuItem -label $rendererUIName -enableCommandRepeat false ("prefRendererOptionMenuItem" +$i);
  2672.         }
  2673.  
  2674.     setParent $parent;
  2675.  
  2676.     setUITemplate -popTemplate;
  2677.  
  2678.     prefsUpdateRendering();
  2679. }
  2680.  
  2681. // Description: called when a selection is made in the preferred renderer
  2682. //                option menu. Sets the preferredRenderer optionVar.
  2683. // Returns:        None
  2684. //
  2685. global proc updatePreferredRendererSel()
  2686. {
  2687.     string $selRenderer = `optionMenu -query -value prefRendererOptionMenu`;
  2688.     string $renderers[] = `renderer -query -namesOfAvailableRenderers`; 
  2689.     string $rendererUIName = "";    
  2690.     int $preferredRendererExists = 0;
  2691.     //Get the index of the selected renderer
  2692.     //
  2693.     for ($i = 0; $i < size($renderers); $i++)
  2694.     {
  2695.         $rendererUIName = `renderer -query -rendererUIName $renderers[$i]`;
  2696.         if($selRenderer == $rendererUIName)
  2697.         {
  2698.             $preferredRendererExists = 1;
  2699.             break;
  2700.         }
  2701.     }
  2702.  
  2703.     // If the select renderer is not installed, produce error
  2704.     //
  2705.     if(!$preferredRendererExists)
  2706.     {
  2707.         error     -showLineNumber    true
  2708.                    ($rendererUIName + " does not exist ");
  2709.     }
  2710.     else
  2711.     {
  2712.         optionVar -stringValue "preferredRenderer" $renderers[$i];
  2713.     }
  2714. }
  2715.  
  2716. global proc prefSetProjectVars( string $which )
  2717. {
  2718.     string $control;
  2719.     string $value;
  2720.     string $varName;
  2721.     if ( gmatch( $which, "Initial*" ) )
  2722.     {
  2723.         $control = "initialProject";
  2724.         $varName = "InitialProject";
  2725.     }
  2726.     else
  2727.     {
  2728.         $control = "projectsDir";
  2729.         $varName = "ProjectsDir";
  2730.     }
  2731.  
  2732.     if ( `textField -q -en $control` )
  2733.     {
  2734.         string $value = `textField -q -tx $control`;
  2735.         if ( $value != "" )
  2736.         {
  2737.             optionVar -sv $varName `textField -q -tx $control`;
  2738.         }
  2739.         else
  2740.         {
  2741.             optionVar -rm $varName;
  2742.         }
  2743.     }
  2744. }
  2745.  
  2746. global proc int prefSetProjectDir( string $which, string $dir, string $type )
  2747. {
  2748.     if ( gmatch( $which, "Initial*" ) )
  2749.     {
  2750.         textField -e -tx $dir initialProject;
  2751.     }
  2752.     else
  2753.     {
  2754.         textField -e -tx $dir projectsDir;
  2755.     }
  2756.  
  2757.     prefSetProjectVars( $which );
  2758.     return 1;
  2759. }
  2760.  
  2761. global proc prefBrowseForFolder( string $which )
  2762. {
  2763.     string $cmd = "prefSetProjectDir \"" + $which + "\"";
  2764.     string $action = "Set " + $which;
  2765.     string $startInDir;
  2766.     if ( gmatch( $which, "Initial*" ) )
  2767.     {
  2768.         $startInDir = `textField -q -tx initialProject`;
  2769.         if ( size( $startInDir ) == 0 )
  2770.         {
  2771.             $startInDir = `internalVar -uwd`;
  2772.         }
  2773.     }
  2774.     else
  2775.     {
  2776.         $startInDir = `textField -q -tx projectsDir`;
  2777.         if ( size( $startInDir ) == 0 )
  2778.         {
  2779.             $startInDir = `internalVar -uwd`;
  2780.         }
  2781.     }
  2782.  
  2783.     if ( `file -q -ex $startInDir` ) {
  2784.         workspace -dir $startInDir;
  2785.     }
  2786.  
  2787.     fileBrowser( $cmd, $action, "", 4 );
  2788. }
  2789.  
  2790. global proc prefsCreateFileIO() 
  2791. {
  2792.     global string $gPreferenceWindow;
  2793.     setParent $gPreferenceWindow;
  2794.     string $parent = "prefFileIOCol";
  2795.     
  2796.     // Check to see if this has been created already.
  2797.     //
  2798.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2799.         return;
  2800.     }
  2801.  
  2802.     //  Create the UI
  2803.     //
  2804.     setParent $parent;
  2805.     setUITemplate -pushTemplate prefsTemplate;
  2806.  
  2807.     // This is used to force the width to fill the window
  2808.     separator -style "none" -h 1 -w 490;
  2809.  
  2810.     frameLayout -l "Project Settings";
  2811.         
  2812.         string $envVar;
  2813.  
  2814.         columnLayout -adj true -cat "left" 35 -cal "left";
  2815.  
  2816.             text -l "Default Projects Directory";
  2817.  
  2818.             columnLayout -adj true -cat "left" 40 -cal "left";
  2819.             
  2820.                 rowLayout -nc 2
  2821.                     -cw2 300 50
  2822.                     -cal 1 "both"
  2823.                     -cal 2 "left"
  2824.                     -ct2 "both" "left";
  2825.  
  2826.                     textField 
  2827.                         -cc ( "prefSetProjectVars \"Projects Dir\" " )
  2828.                         projectsDir;
  2829.                     symbolButton -image "navButtonBrowse.xpm" 
  2830.                         -c ( "prefBrowseForFolder \"Projects Dir\" " )
  2831.                         projectsDirBrowser;
  2832.                 setParent ..;
  2833.                 
  2834.                 $envVar = `getenv "MAYA_PROJECTS_DIR"`;
  2835.                 if ( size( $envVar ) > 0 )
  2836.                 {
  2837.                     text -al "left"
  2838.                         -l " Set from env variable MAYA_PROJECTS_DIR";
  2839.                 }
  2840.             setParent ..;
  2841.  
  2842.             separator -st "none" -h 4;
  2843.  
  2844.             text -l "Always Start in This Project";
  2845.     
  2846.             columnLayout -adj true -cat "left" 40 -cal "left";
  2847.         
  2848.                 rowLayout -nc 2
  2849.                     -cw2 300 50
  2850.                     -cal 1 "both"
  2851.                     -cal 2 "left"
  2852.                     -ct2 "both" "left";
  2853.  
  2854.                 textField 
  2855.                     -cc ( "prefSetProjectVars \"Initial Project\" " )
  2856.                     initialProject;
  2857.                 symbolButton -image "navButtonBrowse.xpm"
  2858.                     -c ( "prefBrowseForFolder \"Initial Project\" " )
  2859.                     initialProjectBrowser;                
  2860.  
  2861.             setParent ..;
  2862.  
  2863.             $envVar = `getenv "MAYA_PROJECT"`;
  2864.             if ( size( $envVar ) > 0 )
  2865.             {
  2866.                 text -al "left"
  2867.                     -l " Set from env variable MAYA_PROJECT";
  2868.             }
  2869.         setParent ..;
  2870.  
  2871.     setParent $parent;
  2872.  
  2873.     separator -st "none" -h 5;
  2874.  
  2875.     frameLayout -l "Recent History Size";
  2876.  
  2877.         columnLayout -cat "left" 0 -cal "center";
  2878.  
  2879.             columnLayout -cat "left" 15 -cal "center";
  2880.     
  2881.                 intSliderGrp -l "Files"
  2882.                     -f true
  2883.                     -min 1
  2884.                     -max 20
  2885.                     -s 1
  2886.                     -cc "optionVar -iv \"RecentFilesMaxSize\" #1"
  2887.                     RecentFilesMaxSize;
  2888.     
  2889.             setParent ..;
  2890.  
  2891.             columnLayout -cat "left" 15 -cal "center";
  2892.     
  2893.                 intSliderGrp -l "Increments"
  2894.                     -f true
  2895.                     -min 1
  2896.                     -max 20
  2897.                     -s 1
  2898.                     -cc "optionVar -iv \"RecentBackupsMaxSize\" #1"
  2899.                     RecentBackupsMaxSize;
  2900.     
  2901.             setParent ..;
  2902.  
  2903.             columnLayout -cat "left" 15 -cal "center";
  2904.  
  2905.                 intSliderGrp -l "Projects"
  2906.                     -f true
  2907.                     -min 1
  2908.                     -max 20
  2909.                     -s 1
  2910.                     -cc "optionVar -iv \"RecentProjectsMaxSize\" #1"
  2911.                     RecentProjectsMaxSize;
  2912.  
  2913.             setParent ..;
  2914.  
  2915.         setParent ..;
  2916.  
  2917.     setParent $parent;
  2918.  
  2919.     separator -st "none" -h 5;
  2920.  
  2921.     frameLayout -l "Ascii File Compression Mode";
  2922.         columnLayout -adj true;
  2923.             
  2924.             radioButtonGrp -nrb 3
  2925.                 -l "On File Save" 
  2926.                 -la3 "Compressed" "Uncompressed" "As Is"
  2927.                 -on1 "translator -cmp \"compressed\""
  2928.                 -on2 "translator -cmp \"uncompressed\""
  2929.                 -on3 "translator -cmp \"asCompressed\""
  2930.                 compressionRBG;
  2931.  
  2932.     setParent $parent;
  2933.  
  2934.     separator -style "none" -h 5;
  2935.  
  2936.     frameLayout -l "Display Layer";
  2937.         columnLayout -adj true;
  2938.  
  2939.             radioButtonGrp -nrb 3
  2940.                 -l "File Import Merge" 
  2941.                 -la3 "None" "By Number" "By Name"
  2942.                 -on1 "optionVar -iv displayLayerMerge 0"
  2943.                 -on2 "optionVar -iv displayLayerMerge 1"
  2944.                 -on3 "optionVar -iv displayLayerMerge 2"
  2945.                 layerMerge;
  2946.  
  2947.     setParent $parent;
  2948.  
  2949.     setUITemplate -popTemplate;
  2950.  
  2951.     prefsUpdateFileIO();
  2952. }
  2953.  
  2954. global proc prefsCreateModules() 
  2955. {
  2956.     global string $gPreferenceWindow;
  2957.     setParent $gPreferenceWindow;
  2958.     string $parent = "prefModulesCol";
  2959.     
  2960.     // Check to see if this has been created already.
  2961.     //
  2962.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  2963.         return;
  2964.     }
  2965.  
  2966.     //  Create the UI
  2967.     //
  2968.     setParent $parent;
  2969.     setUITemplate -pushTemplate prefsTemplate;
  2970.  
  2971.     // This is used to force the width to fill the window
  2972.     separator -style "none" -h 1 -w 490;
  2973.  
  2974.     frameLayout -l "Load on Startup";
  2975.         columnLayout -adj true;
  2976.  
  2977.             checkBoxGrp -ncb 1
  2978.                 -l ""
  2979.                 -cw 1 75
  2980.                 -l1 "Dynamics"
  2981.                 -on1 "optionVar -iv loadDynamics 1"
  2982.                 -of1 "optionVar -iv loadDynamics 0"
  2983.                 packCBG1;
  2984.  
  2985.             checkBoxGrp -ncb 1
  2986.                 -l ""
  2987.                 -cw 1 75
  2988.                 -l1 "Paint Effects"
  2989.                 -on1 "optionVar -iv loadUrchin 1"
  2990.                 -of1 "optionVar -iv loadUrchin 0"
  2991.                 packCBG8;
  2992.  
  2993.     // On Mac its not possible to stop the loading of Paint Effects (libUrchin)
  2994.     // and Dynamics on startup, hence do not allow the user to change this preference
  2995.  
  2996.     if (`about -mac`) {
  2997.         checkBoxGrp -e -en false packCBG8;
  2998.         checkBoxGrp -e -en false packCBG1;
  2999.     }
  3000.  
  3001.     setParent $parent;
  3002.  
  3003.     setUITemplate -popTemplate;
  3004.  
  3005.     prefsUpdateModules();
  3006. }
  3007.  
  3008. global proc prefsCreateOpenMaya() 
  3009. {
  3010.     global string $gPreferenceWindow;
  3011.     setParent $gPreferenceWindow;
  3012.     string $parent = "prefOpenMayaCol";
  3013.  
  3014.     // openMaya prefs are not available on NT
  3015.     if (`about -nt`) return;
  3016.     
  3017.     // Check to see if this has been created already.
  3018.     //
  3019.     if (`columnLayout -q -numberOfChildren $parent` > 0) {
  3020.         return;
  3021.     }
  3022.  
  3023.     //  Create the UI
  3024.     //
  3025.     setParent $parent;
  3026.     setUITemplate -pushTemplate prefsTemplate;
  3027.  
  3028.     // This is used to force the width to fill the window
  3029.     separator -style "none" -h 1 -w 490;
  3030.  
  3031.     frameLayout -l "OpenMaya";
  3032.         columnLayout -adj true;
  3033.  
  3034.         radioButtonGrp -nrb 2
  3035.             -l "Loading" 
  3036.             -cw 1 150
  3037.             -la2 "Lazy Binding" "Bind Now"
  3038.             -sl (`optionVar -q apiPrefLazyLoading` ? 1 : 2) 
  3039.             -on1 "openMayaPref -e -lz true"
  3040.             -on2 "openMayaPref -e -lz false"
  3041.             lazyLoadingCheck;
  3042.  
  3043.         radioButtonGrp -nrb 2
  3044.             -l "Old Plugin Warning" 
  3045.             -cw 1 150
  3046.             -la2 "Enabled" "Disabled"
  3047.             -sl (`optionVar -q apiPrefOldPluginWarning` ? 1 : 2) 
  3048.             -on1 "openMayaPref -e -ow true"
  3049.             -on2 "openMayaPref -e -ow false"
  3050.             oldPluginWarningCheck;
  3051.  
  3052.     setParent $parent;
  3053.  
  3054.     setUITemplate -popTemplate;
  3055.  
  3056.     prefsUpdateOpenMaya();
  3057. }
  3058.